# cron and timezone?



## estrabd (Oct 25, 2010)

I recently got serious about time on my system and changed the timezone to the one I am in (CDT) from UTC. I also set up NTP - now my time is "correct" (as in when I type `date`), but it seems to me that crond is still timing the scheduled tasks wrt UTC.  How do I make crond respect my timezone settings?  TIA!

I'm at: 7.2-RELEASE-p6 FreeBSD 7.2-RELEASE-p6 #1


----------



## SirDice (Oct 25, 2010)

Kerneltime is always in UTC. As a result the times in crontab are also always in UTC.


----------



## estrabd (Oct 25, 2010)

Okay, thank you. I guess that I will just adjust the times in my crontab .

Brett


----------



## DutchDaemon (Oct 25, 2010)

Huh? My crontab entries are in 'my local time' (*CEST* right now), the same time and time zone that my 'date' reports. If you set the correct time zone and it is reflected in the date output, you can set your cron jobs to your local time. Or, to put it in pseudo-human terms: crond will 'run date' to see if it's time to run a scheduled job; in my case, if that job is scheduled to run at 11:00 (0 11 * * *), it will run at 11:00 *CEST*, not 11:00 *UTC*.


----------



## jalla (Oct 25, 2010)

SirDice said:
			
		

> Kerneltime is always in UTC. As a result the times in crontab are also always in UTC.



You're kidding, right?


----------



## SirDice (Oct 25, 2010)

Arrr... Yeah, I'm wrong. 

The reason I thought they were is because all our servers are running on UTC time. If you run a global shop that's the only way to make sure things start at the same time all over the world.


----------



## kpa (Oct 25, 2010)

Make sure you have run tzsetup(8) with correct options. I think you need to reboot to make the changes effective.


----------



## DutchDaemon (Oct 25, 2010)

SirDice said:
			
		

> Arrr... Yeah, I'm wrong.
> 
> The reason I thought they were is because all our servers are running on UTC time. If you run a global shop that's the only way to make sure things start at the same time all over the world.



Ah yes, I used to do that in my ISP days, though I had all servers around the different time zones running on Dutch time


----------



## estrabd (Oct 25, 2010)

I just realized that being on a xen image at a host might have something to do with this time thingy. 

Brett


----------



## DutchDaemon (Oct 25, 2010)

That might influence your ntp/time accuracy, but the /etc/localtime settings shouldn't be affected. They're just a local filter to move the time forward or back from UTC and to incorporate appropriate summer/winter time settings.


----------



## SirDice (Oct 25, 2010)

DutchDaemon said:
			
		

> Ah yes, I used to do that in my ISP days, though I had all servers around the different time zones running on Dutch time



Hehehe... That would confuse the heck out of our Malaysian first and second line support on whom I depend. They are confused and confusing enough as it is 

Running everything on UTC has it's benefits though. I never have to worry about daylight savings or timezones.


----------



## estrabd (Oct 25, 2010)

I confirmed that my host was running in UTC on my node; a suggested restart of crond seems to have fixed the issue. Thanks for all the help - the mention about the ISP is what made me think to contact them.

Brett


----------

