Skip to content

Commit

Permalink
Update check_cron.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
cmliu authored Aug 2, 2024
1 parent 2516792 commit b27cb77
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions check_cron.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ REBOOT_COMMAND="@reboot pkill -kill -u $(whoami) && $PM2_PATH resurrect >> /home

echo "检查并添加 crontab 任务"

if command -v pm2 > /dev/null 2>&1 && [[ $(which pm2) == "/home/${USER,,}/.npm-global/bin/pm2" ]]; then
echo "已安装 pm2 ,启用 pm2 保活任务"
if [ "$(command -v pm2)" == "/home/${USER,,}/.npm-global/bin/pm2" ]; then
echo "已安装 pm2,并返回正确路径,启用 pm2 保活任务"
(crontab -l | grep -F "$REBOOT_COMMAND") || (crontab -l; echo "$REBOOT_COMMAND") | crontab -
(crontab -l | grep -F "$CRON_JOB") || (crontab -l; echo "$CRON_JOB") | crontab -
else
Expand Down

0 comments on commit b27cb77

Please sign in to comment.