1. sh脚本编写
appName=cvcp-weather
PID=`ps -ef |grep java | grep $appName | grep -v grep | awk '{print $2}'`
if [ "$PID" == "" ]; thensleep 1;echo "no process";elseecho "process exsits";kill -9 $PID
fi
sleep 2s
nohup /usr/local/java/jdk1.8.0_144/bin/java -server -Xms1024m -Xmx1024m -Xmn1024M -Xss1024k -XX:+AggressiveOpts -XX:+UseBiasedLocking -XX:+DisableExplicitGC -Djava.awt.headless=true -DLOG_HOME="weather-hf" -jar /data/cvcp-weather-hf-1.0.0.jar --spring.profiles.active=dev > /data/logs/cvcp-weather-hf.out 2>&1 &
**2.配置Linux定时任务
crontab -e添加如下内容(每天1点08分执行)
8 1 * * * /start-weather.sh