lunix tomcat重启脚步

时间:2022-09-10 03:11:07

[wlcf@iZbp12oby5qekkz14dlokeZ ~]$ cat restart_tomcat
#!/bin/sh
if [ $# != 1 ] ; then
echo "USAGE: $0 cms|api|task|static|file"
echo " e.g.: $0 cms"
exit 1;
fi
TomcatID=$(ps -ef|grep tomcat-$1|grep -v 'grep'|awk '{print $2}')
StartTomcat=/home/wlcf/tomcat-$1/bin/startup.sh

if [ $TomcatID ];then
echo "[info]tomcat-$1进程ID为:$TomcatID."
echo "[info]开始kill tomcat-$1"
kill -9 $TomcatID # 杀掉原tomcat进程
else echo "[info]没有发现tomcat-$1进程"
fi
echo "[info]开始start tomcat-$1"$StartTomcat
$StartTomcat