#!/bin/sh
. /etc/profile
pid=`ps aux | grep tomcat | grep -v grep | grep -v retomcat | awk '{print $2}'`
echo $pid
if [ -n "$pid" ]
then
{
echo ===========shutdown================
/userdata1/server/apache-tomcat-7.0.20/apache-tomcat-7.0.20/bin/shutdown.sh
sleep 1
pid=`ps aux | grep tomcat | grep -v grep | grep -v retomcat | awk '{print $2}'`
if [ -n "$pid" ]
then
{
sleep 1
echo ========kill tomcat==============
kill -9 $pid
}
fi
sleep 1
echo ===========startup.sh==============
/userdata1/server/apache-tomcat-7.0.20/apache-tomcat-7.0.20/bin/startup.sh
}
else
echo ===========startup.sh==============
/userdata1/server/apache-tomcat-7.0.20/apache-tomcat-7.0.20/bin/startup.sh
fi
Linux下定时重启tomcat脚本
点赞
收藏