Root User Cron Job times - Adjusting for UTC?
So we are moving from CentOS to CloudLinux for our server and for a decade and a half we have always run our server at our local timezone (Chicago). I am aware this is (was?) not the best practice due to possible DST issues, etc. On the new server I want to finally switch this so the server is set to UTC but I'm looking at the cpanel installed cron jobs for the root user and it appears that they are all configured to run at specific times which appear to assume the system time is local and not UTC.
However when the system is set to UTC time zone, the cron job scheduled to run at "midnight" (0 0 * * *), for example, will actually run at 6PM and not 12AM as we are UTC-600 currently. Or the normally scheduled account backup script that is intended to run at 2am is now going to run at 8pm the previous day, locally speaking. Is this going to be a problem if just left alone?
Is there a recommended way to adjust these times so they are relative to my actual time zone? For example, is there a script I can run, or button I can press somehwere that would reset the cron script times based on the UTC offset for our local TZ?
Or should i just go in there and add +6 to the hour column of all the jobs that are not */n (every n hours)?
e.g. change:
0 0 * * * /usr/local/bin/rkhunter --update > /dev/null 2>&1
to
0 6 * * * /usr/local/bin/rkhunter --update > /dev/null 2>&1
The other side effect on CRON from setting the server time zone to UTC is that right now with DST active, we are UTC-6, however the other half of the year we are UTC-5 when in standard time. This would mean that for 1/2 the year, all of my cron scripts would run an hour early or late (relative to my actual time-zone) depending on how they are set. I guess that doesn't really matter that much but it still sort of bugs me because I don't know what all the scripts do and if it matters if the perceived needs to be accurate given which side of midnight a script is ran.
Anyone have any advise on this matter?
Please sign in to leave a comment.
Comments
0 comments