#!/bin/bash
ip_last=$1
project_name=$2
branch_name=$3
public_ip=$4
set timeout 1200
ip=192.168.4.$ip_last
echo "参数为：
#init_shell_script: ${init_shell_script}
ip : ${ip}
project_name : ${project_name}
branch_name : ${branch_name}
public_ip : ${public_ip}
"

	expect -c "
		 set timeout 10
	   spawn ssh root@${ip}
		 expect \"]#\"
		 send \"cd /home/qa-deploy-utils/qa_shell_script\r\"
		 expect \"]#\"
		 send \"sh deploy_project_by_name.sh $project_name $branch_name $public_ip\r\"
		 set timeout -1
		 expect \"]#\"
		 send \"sh special_project/msg_center.sh\r\"
		 set timeout -1
		 expect \"]#\"
		 send \"sh 5_restart_by_name.sh $project_name\r\"
		 set timeout -1
	   expect \"]#\"
	   send \"exit\r\"
	expect eof;"
