美文网首页
springboot 定时重启 centos

springboot 定时重启 centos

作者: 写代码的杰西 | 来源:发表于2022-01-07 16:26 被阅读0次
!/bin/bash
ID=`ps -ef | grep 进程名| grep -v "grep" | awk '{print $2}'`
echo $ID
echo "---------------"
for id in $ID;
do
kill -9 $id
echo "killed $id"
done
source /etc/profile
nohup java -jar /tempurl/tempname.jar -server.port=9090 >> /tempurl/nohup.out &
echo "reset success"

1、编辑定时任务:
crontab -e
2、设置定时执行cron表达式,每天凌晨一点执行:
0 1 * * * /tempurl/auto_reset_springboot.sh
3、重置定时器
service crond restart

相关文章

网友评论

      本文标题:springboot 定时重启 centos

      本文链接:https://www.haomeiwen.com/subject/jcwjcrtx.html