ssh $server "pkill -9 -f $tomcat"
ssh $server "rm -rf $tomcat/webapps/ROOT; mv $tomcat/webapps/ROOT.war $tomcat/webapps/ROOT.war.bak"
scp $project.war $server:$tomcat/webapps/ROOT.war
ssh $server "chown $tomcat/webapps/ROOT.war"
ssh $server "su - www -c $tomcat/bin/startup.sh"
sleep 5
3, 回滚脚本(跳板机)
#!/bin/bash
project="$1"
if [ $# -lt 1 ]; then
echo "usage: $0 <project>"
exit 1
fi
case "$project" in
test_api)
tomcat=/opt/tomcat_api
server="test"
;;
test_report)
tomcat=/opt/tomcat_report
server="test"
;;
test_job)
tomcat=/opt/tomcat_job
server="test"
;;
esac
ssh $server "pkill -9 -f $tomcat"
ssh $server "rm -rf $tomcat/webapps/ROOT; mv $tomcat/webapps/ROOT.war.bak $tomcat/webapps/ROOT.war"
ssh $server "su - www -c $tomcat/bin/startup.sh"
sleep 5
Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx