当前位置: 动力学知识库 > 问答 > 编程问答 >

linux - Crontab Execute at the wrong time

问题描述:

I have a crontab settings as follow :

sudo crontab -l -u bheng


#field allowed values

# ----- --------------

# minute 0-59

# hour 0-23

# day of month 1-31

# month 1-12 (or names, see below)

# day of week 0-7 (0 or 7 is Sun, or use names)

#

# m h dom mon dow command

MAILTO="[email protected]"

#Daily

01 22 * * * php /home/mysite.com/artisan products:exportdiff --interval="yesterday"

16 22 * * * php /home/mysite.com/artisan images:exportdiff --interval="yesterday"

31 22 * * * php /home/mysite.com/artisan publications:exportdiff --interval="yesterday"

#Weekly

1 23 * * 7 php /home/mysite.com/artisan publications:exportdiff --interval="last sunday"

16 23 * * 7 php /home/mysite.com/artisan images:exportdiff --interval="last sunday"

31 23 * * 7 php /home/mysite.com/artisan products:exportdiff --interval="last sunday"

As you can see, it suppose to be kicking at 10 and 11 PM at night.

But instead, I got 3 emails at 5 PM yesterday at 5:01 PM , 5:16 PM, 5:31 PM


I thought

it was the time wrong the in system or VM so I checked it I saw UTC time.

Then, I update it by running sudo dpkg-reconfigure tzdata and set it to US Easetern time.

Now, when I ran date command I got Ex.Thu Dec 15 07:56:27 EST 2016 correctly as US EST time.


Question

Is there some service that I need to restart ?

Or

Is this something other crontab settings that migth have overwrite my current settings ?

How would one go about and debug this further ?


I'm opening to any suggestions at this moment.

Any hints / suggestions / helps on this be will be much appreciated !

网友答案:

I believe you have to restart cron after making time / time zone related changes.

Depending on your version of cron, you might be able to restart it with sudo service cron restart.

分享给朋友:
您可能感兴趣的文章:
随机阅读: