shell 脚本启动tomcat服务
#!/bin/bash # kill tomcat进程 tomcat_fashion_dev_pid=`ps aux|grep tomcat_fashion_dev|grep -v "grep"|awk '{print $2}'` if [ "$tomcat_fashion_dev_pid" ];then ps aux|grep tomcat_fashion_dev|grep -v "grep"|awk '{print $2}'|xargs kill -9 echo "old tomcat fashion dev process is killed" fi rm -rf /home/deploy/fashion/dev/deploy_files/* echo "delete old project files /home/deploy/fashion/dev/deploy_files" #解压war包到 代码执行地方 cd /home/deploy/fashion/dev/ unzip -oq fashion.war -d /home/deploy/fashion/dev/deploy_files/ #重启tomcat cd /home/deploy/tomcat_fashion_dev/bin sh startup.sh sleep 5 tomcatport=` netstat -lntp|grep "8080"|awk '{print $4}'|awk -F":" '{print $2}'` echo $tomcatport if [ "$tomcatport" ];then echo -e "\033[32m[ tomcat fashion started success on dev env ! ]\033[0m" fi