标签:
用root用户
cat /home/mengt/tomcat/bin/setenv.sh
vi setenv.sh
增加export CATALINA_PID=/home/mengt/tomcat/tomcat.pid
[icet@multiserver tomcat]$ vi shutdown_tomcat.sh
写入
#!/bin/bash
# $1 = tomcat path
# $2 = shutdown wait seconds
TOMCAT_PATH=$1
PID_FILE=$TOMCAT_PATH/tomcat.pid
if [ -f $PID_FILE ]; then
PID=`cat $PID_FILE`
kill $PID
sleep $2
kill -0 $PID > /dev/null 2>&1
return_code=$?
if [ $return_code -eq 0 ]; then
kill -9 $PID
fi
fi
crontab -e
30 17 * * * /home/mengt/tomcat/shutdown_tomcat.sh /home/mengt/tomcat 15 >/dev/null 2>&1
0 8 * * * /home/mengt/tomcat/bin/startup.sh >/dev/null 2>&1
crontab -l
增加执行的命令
chmod +x shutdown_tomcat.sh
标签:
原文地址:http://www.cnblogs.com/buptmt/p/4604405.html