服务器定时任务
1、jar启动脚本
start.sh文件:
#!/bin/bash timeNow=$(date "+%Y-%m-%d %H:%M:%S") echo $timeNow":start springboot_quick2-0.0.1-SNAPSHOT.jar..." kill -9 $(ps -ef | grep springboot_quick2-0.0.1-SNAPSHOT.jar | grep -v grep | awk '{print $2}' | xargs) nohup /usr/local/java/jdk1.8.0_192/bin/java -jar /data/quick_0/springboot_quick2-0.0.1-SNAPSHOT.jar >>/data/quick_0/log.txt 2>&1 &
注意:这里jdk的路径最好用绝对路径,不然会失效