最近使用了一个小服务器,1g1k,tomcat jvm不够,老是重启,就写了一个脚本自动重启
n=$(jps|wc -l)
if [[ $n -eq 1 ]]; then
/opt/tomcat9/bin/startup.sh
fi
在cron 里配置
crontab -e
*/1 * * * * /home/lpf/commond/restart
centos cron 是没有秒的,分钟 小时 日 月周 命令,周也不是?号。
来源:oschina
链接:https://my.oschina.net/internetafei/blog/4767243