检测tomcat关闭的shell

以梦为马不负韶华 2012-09-29

#!/bin/sh
pid=`ps aux | grep tomcat | grep -v grep | grep -v retomcat | awk '{print $2}'`
echo $pid
if [ -n "$pid" ]
then
{
echo ===========shutdown================
/etc/init.d/tomcat6 stop
sleep 2
pid=`ps aux | grep tomcat | grep -v grep | grep -v retomcat | awk '{print $2}'`
if [ -n "$pid" ]
then
{
sleep 2
echo ========kill tomcat begin==============
echo $pid
kill -9 $pid
echo ========kill tomcat end==============
}
fi
sleep 2
echo ===========startup.sh==============
/etc/init.d/tomcat6 restart
}
else
echo ===========startup.sh==============
/etc/init.d/

相关推荐

WeiHHH / 0评论 2020-03-01
zhongcanw / 0评论 2020-02-14