#!/bin/bash
project_name=$1
branch_name=$2
public_ip=$3
ip=$4
idc=$5

if [ -z "$project_name" ];then
	echo "清输入项目名称"
	exit -1
fi

sh /home/qa-deploy-utils/qa_shell_script/2_get_code_by_name.sh $project_name $branch_name $ip
if [ $? = 0 ]; then
	echo "--- $ip $project_name 2_get_code_by_name ok ---"
else
	echo "--- $ip $project_name 2_get_code_by_name fail ---"
	exit -1
fi
 
sh /home/qa-deploy-utils/qa_shell_script/3_link_config_file_by_name.sh $project_name $public_ip $ip
if [ $? = 0 ]; then
	echo "--- $ip $project_name 3_link_config_file_by_name ok ---"
else
	echo "--- $ip $project_name 3_link_config_file_by_name fail ---"
	exit -1
fi

sh /home/qa-deploy-utils/qa_shell_script/4_build_by_name.sh $project_name $public_ip $ip
if [ $? = 0 ]; then
	echo "--- $ip $project_name 4_build_by_name ok ---"
else
	echo "--- $ip $project_name 4_build_by_name fail ---"
	exit -1
fi

sh /home/qa-deploy-utils/qa_shell_script/5_restart_by_name.sh $project_name $public_ip $ip $idc
if [ $? = 0 ]; then
	echo "--- $ip $project_name 5_restart_by_name ok ---"
else
	echo "--- $ip $project_name 5_restart_by_name fail ---"
	exit -1
fi

