crontab -e
PATH=/bin:/usr/bin:/usr/local/bin
* * * * * /source_path/sample.sh
sample.sh
export PATH=$PATH:/home/java_jre_path/jre/bin/
if ps -ef | egrep 'home.dir=.*WebWildfly' | grep -v grep | awk '{print $2}'
then
echo "Running"
else
cd /home/cbgl/cbgl/WebWildfly/bin/
nohup ./standalone.sh &
fi:
做完以上需
systemctl restart crond
重啟 crontab
檢查 服務是否正確執行
tail -50 /var/log/cron