My syslog time and the kernel's time seem to be in different timezones and cron is not picking up.

April 27, 2018 1.2k views
Linux Basics Ubuntu

Hey all,
I have a droplet in the Bangalore region and I’m facing a problem where my crons are not being picked up if I specify a time.
This is what I’ve debugged so far:

sudo tail -f /var/log/syslog

Apr 27 00:45:01 by2rides-app-2 cron[1021]: (*system*by2rides-auto-create) RELOAD (/etc/cron.d/by2rides-auto-create)

I created this file /etc/cron.d/by2rides-auto-create itself at exactly Apr 27 10:20 - so clearly the syslog is in a different timezone.
Additionally, I also checked this.

cat /etc/timezone 

And my cron.d was very specific:

21 10 * * 1-5 root curl --request GET http://localhost:8080/xyz

The cron is not being piked up. However, if I change it by removing concept of time altogether and keep it at a interval, it gets picked up. So clearly we have timezone issues !

*/5 * * * 1-5 root curl --request GET http://localhost:8080/xyz

Anyone else faced this issue ?

2 Answers

I am not sure how the syslog and kernel could have two different reported times. With your original cron configuration does the task run but just at the wrong time?


I just found the solutions for my situation - restarting rsyslog. After setting up chrony for desired NTP and clock management, I neglected to restart the logging daemon. Once this was done, all now seems right and proper.


I have this exact same issue. To verify this is only on DO, I built 2 other CentOS VMs on my ESX server and other cloud infrastructure. None experience this issue - only my DO droplet has this discrepancy.

Anyone have some suggestions or solution to fix this? I suspect there is something in the DO infrastructure that is forcing some syslog messages to be reported using UTC rather than the local time of the server.

Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!