Cron job in a different timezone

后端 未结 5 928
情深已故
情深已故 2020-12-31 05:27

Is there a way of setting up a cronjob for a specific timezone?

My shared hosting is in USA (Virginia) and I am in UK. If I set a cron job to be executed at 1600 hrs

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-31 05:50

    I think that you should check

    /etc/default/cron
    

    or just type

    Crontab cronfile
    

    and you should find

    TZ=UTC
    

    This should be changed (for example America/New_York). Second way is set in cron example

    5 2 3 * * TZ="America/New_York" /do/command > /dev/null 2>&1
    

提交回复
热议问题