restart.sh 脚本
#!/bin/sh
source /etc/profile
source ~/.bash_profile
jarDir="/data/hsecloud/jdk1.8.0_191"
echo " =====关闭Java应用======"
PROCESS=`ps -ef |grep java |grep -v grep|grep min-bao-pro|awk '{print $2}'`
for i in $PROCESS
do
echo "现在进程是: $i"
echo "Kill the $1 process [ $i ]"
kill -9 $i
done
echo " =====启动Java应用======"
nohup java -jar -Xms1024m -Xmx1536m /data/apps/hse-minbao/min-bao-pro-20230419_202003-1.0.40.jar > /data/apps/hse-minbao/pro.out &
定时任务列表查看: > crontab -l
定时任务编辑: > > crontab -e
每周二和周五早上8:10分执行脚本 >> > > 10 08 * * 2,5 /data/apps/hse-staff/restart.sh
善于将复杂问题简单化