Why is this cron entry executed twice?

前端 未结 12 1028
栀梦
栀梦 2020-12-10 01:39
*/5 * * * * my command

This entry works but every 5 minutes it gets executed twice, why?

In /var/log/cron it shows:

         


        
12条回答
  •  盖世英雄少女心
    2020-12-10 02:20

    The wget in crontab has often a limit of 15 minutes. In our case this was just the case, and after those 15 minutes the job ends up with a timeout and then re-runs again right away. So, the solution to this was to set up the cronjob in crontab somewhat like this :

    1 2 * * * root wget --read-timeout=3600 -O - 'http://cron-job-url' >/dev/null 2>&1
    

    ...instead of

     1 2 * * * root wget -O - 'http://cron-job-url' >/dev/null 2>&1
    

    So, wget is the thing. Meaning 3600 = 1 hour then. Or more if you need!

提交回复
热议问题