linux下持续集成自动部署脚本,自动从jekins拉取war包并重新部署 (我去,一个大坑,if中的变量要双引号引起来,不然始终是true)

[root@localhost tomcat-gl-8082]# cat deploy.sh 
rm -rf webapps/gl/*
rm -rf gl.war
wget -qc "http://192.168.0.102:9000/jenkins/job/gl/ws/gl.war"
echo "正在解压"
unzip gl.war -d webapps/gl >/dev/null 2>&1
cp -r /configbak/gl/* webapps/gl/WEB-INF/classes
ports="8082 8025"
for port in $ports
do
  echo "killing port $port"
  pid=`lsof -i:$port |awk '{print $2}' |grep -v PID`
  if [ -n "$pid" ];then
      kill -9 $pid
  fi
done
sleep 1s
sh bin/startup.sh
tail -fn 100 logs/catalina.out
上一篇:mySql 主从复制linux配置


下一篇:aircarck-ng