扫码关注官方订阅号
我想让ubuntu下的tomcat7 实现8个小时就自动重启一次。要怎么弄? 求各路大神献计献策。谢谢!
认证高级PHP讲师
#!/bin/sh
. /etc/profile
pid=ps aux | grep tomcat7_portal | grep -v grep | grep -v retomcat7_portal | awk '{print $2}'echo $pid
ps aux | grep tomcat7_portal | grep -v grep | grep -v retomcat7_portal | awk '{print $2}'
if [ -n "$pid" ]then{ echo ===========shutdown================ /opt/tomcat7_portal/bin/shutdown.sh sleep 1 pid=ps aux | grep tomcat7_portal | grep -v grep | grep -v retomcat7_portal | awk '{print $2}' if [ -n "$pid" ] then
{ sleep 1 echo ========kill tomcat7_portal============== kill -9 $pid }
fi sleep 1 echo ===========startup.sh============== /opt/tomcat7_portal/bin/startup.sh }elseecho ===========startup.sh==============/opt/tomcat7_portal/bin/startup.sh
fi
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
#!/bin/sh
. /etc/profile
pid=
ps aux | grep tomcat7_portal | grep -v grep | grep -v retomcat7_portal | awk '{print $2}'echo $pid
if [ -n "$pid" ]
then
{
echo ===========shutdown================
/opt/tomcat7_portal/bin/shutdown.sh
sleep 1
pid=
ps aux | grep tomcat7_portal | grep -v grep | grep -v retomcat7_portal | awk '{print $2}'if [ -n "$pid" ]
then
fi
sleep 1
echo ===========startup.sh==============
/opt/tomcat7_portal/bin/startup.sh
}
else
echo ===========startup.sh==============
/opt/tomcat7_portal/bin/startup.sh
fi