Cron jobs are not running at the correct time as Scheduled on DBCS system OCI


I was working on DBCS systems on OCI. I tried to scheduled the jobs in crontab on server. But I observed that they were not running on the time it was supposed to run. rather it was running around 5-6 hrs later.

Cron uses system locale settings to determine the time to run its jobs

Things I found:

Check if times on the hardware clock (in BIOS) and the system clock are in agreement. Use the hwclock --show command to check the hardware clock time and use the date command to get the system time.

The output below shows a discrepancy; the system time is the correct one.
[root@ocidb ~]# hwclock --show
Wed 4 2023 11:13:45 UTC  


[root@ocidb ~]# date
Wed 4 2023 16:14:22 UTC 2023

Set the hardware clock to match the system time by using the command 

hwclock --systohc --utc

The --utc flag has been added because keeping the time in UTC allows Linux to automatically account for daylight savings.

[root@ocihost ~]# hwclock --systohc --utc

[root@ocihost ~]# hwclock --show


Now that the hardware and system clocks got in agreement




If you like please follow and comment