I am in Singapore and the server (Ubuntu 22.04 EC2 instance) is set according to the my local timezone (UTC+8H), at least so the date
command tells me.
$ date
Wed Sep 20 09:07:42 +08 2023
Is this a conclusive proof that my timezone setting is local? Unfortunately, my @daily
cronjobs run everyday at 8 am local time, which suggests somehow the cron daemon is following UTC time. Is there a separate timezone setting for the cron daemon other than what I am seeing in the terminal? This is my cron command.
@daily cd tensorflow_clustering/ && bash run_index.sh >> run.log
According to the comment,
$ timedatectl
Local time: Wed 2023-09-20 10:03:11 +08
Universal time: Wed 2023-09-20 02:03:11 UTC
RTC time: Wed 2023-09-20 02:03:10
Time zone: Asia/Singapore (+08, +0800)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
@daily
with0 0 * * *
? They are equivalent. Your problem is unusual. I have tried both of these in cron. I don't live in UTC. – user68186 Sep 20 '23 at 02:17* * * * * timedatectl > /tmp/date
to yourcron
, wait a minute and then check the file/tmp/date
. Does that show a different output than when you runtimedatectl
manually? – terdon Sep 25 '23 at 10:53