linux 持续构建(自动部署) 重启动tomcat或进程的脚本

#!/bin/sh
TOMCAT_PATH=`dirname "$0"` echo "TOMCAT_PATH is /usr/local/tomcat" PID=`ps aux | grep /usr/local/tomcat | grep java | awk '{print $2}'` if [ -n "$PID" ]; then
echo "Will kill tomcat: $PID"
sh "/usr/local/tomcat/bin/shutdown.sh"
sleep
else echo "No Tomcat Process $PID"
fi PID=`ps aux | grep /usr/local/tomcat | grep java | awk '{print $2}'` while [ -n "$PID" ]; do
kill $PID && sleep
echo "Try to kill $PID"
done sh "/usr/local/tomcat/bin/startup.sh"
sleep PID=`ps aux | grep /usr/local/tomcat | grep java | awk '{print $2}'`
if [ -n "$PID" ]; then
echo "\nRestart tomcat successfully!"
else
echo "\nFail to startup tomcat"
exit
fi
/usr/local/tomcat你要替换的内容
上一篇:MySQL性能分析、及调优工具使用详解


下一篇:字符串匹配的sunday算法