!/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
网友评论