jenkins结合shell实现登录远程主机执行shell脚本

#!/bin/bash
cd /home/formax/.jenkins/workspace/FAS/target
rsync -avP --port=8080  FAS.war  192.1.1.168::temp
ssh [email protected]   << remotessh 
cd /data/formax_data/soft/FAS/update
mv FAS.war newFAS.war
mv /data/formax_data/temp/FAS.war . 
cd /data/formax_data/soft/FAS
echo "停止 tomcat ..."
sh stop.sh
sleep 3s
echo "更新 war包 ..."
sh update.sh
sleep 3s
echo "启动 tomcat ..."
sh start.sh
exit 
remotessh 
echo "部署完成"

你可能感兴趣的:(Shell)