Crontab scheduled tasks using notes

As used herein, the linuxinside crontabof the timing tasks running phpprogram

A. crontabUse the command

crontab -eEnter crontab
service crond restart/reloadreboot / reload crontab(here crond)
tail -f /var/log/conto view cronthe log

II. crontabText code

  1. Use curlscripts execute the script
0 3 * * * /usr/bin/curl http://xxx.com/api/method > /dev/null 2>&1 &
  1. Use phpexecute the script execution procedures
0 3 * * * /usr/bin/php http://xxx.com/api/method > /dev/null 2>&1 &

Use phpscripts Note
1. The file must have access allows phppermission to execute the program read and write
2 phpscripts and so can not use the $ _SERVER phpsuperglobal (but this is way more quickly)

Also: with whereis 软件can easily find software location

III. Time crontab cron job description

  1. */1 * * * *Once per minute
    0 3 * * *executed once a day at 3 am

  2. Address verification crontab time
    https://crontab.guru/

Reproduced in: https: //www.jianshu.com/p/960748e0fe2b

Guess you like

Origin blog.csdn.net/weixin_34198762/article/details/91292769