利用jenkins去重启服务
编写重启脚本
#!/bin/bash
function sendToRemote(){
remote_shell_path=/usr/local/tiantian_dubbo
remote_path=/usr/local/tiantian_dubbo/${project}
echo "开始关闭服务"
ssh ${remote_user}@${remote_ip} -p${remote_port} "/bin/sh ${remote_shell_path}/server.sh stop ***************${package_name}" && sleep 2
echo "关闭完成"
echo "开始启动服务"
ssh ${remote_user}@${remote_ip} -p${remote_port} "/bin/sh ${remote_shell_path}/server.sh start ***************${package_name}"
echo "启动完成"
}
function remote(){
project=$1
package_name=$2
parentDirectory=$4
remote_port=51212
remote_user=jenkins
remote_ip=$3
echo "remote_ip:${remote_ip}"
local_dir=/xs/git_project/tiantian_dubbo
sendToRemote
}
case "$@" in
*)
packageName="$1"
parentDirectory="$3"
node="$2"
remote ${packageName%.*} ${packageName} ${node} ${parentDirectory}
;;
esac
echo "$@脚本执行完毕"