PDA

View Full Version : Getting cron to use local time


bjarne
05-18-2004, 02:56 AM
I have been searching, and have not found the answer to this question. I have set up cron to run the moviesort.tcl for moviesearch, and it is working fine. However it seems to be using GMT instead of local time (-0700 PDT). Is there a way to make cron use local time ?

TIA,
Bjarne

drnull
05-18-2004, 03:24 AM
Is there a way to make cron use local time ?

http://www.dealdatabase.com/forum/showthread.php?p=141651&highlight=export+tz%2A#post141651
http://www.dealdatabase.com/forum/showthread.php?p=141810&highlight=export+tz%2A#post141810

Also, man tzset from a linux machine reveals that the format is as follows:

export TZ=xxxDyyy[E]

where xxx is the standard time (MST, PST, EST, etc), and yyy is the daylight savings time (MDT, PDT, EDT?). It really doesn't matter to linux what you put in xxx and yyy as it happily spits it back out as the timezone specifier. Then, D is the offset for xxx and E is the offset for yyy (it defaults to 1 less than D.

So, some examples

export TZ=MST7MDT (or MST7MDT6 would be the same)
export TZ=MST7MDT7 (for us folk in AZ that don't observe DST)
export TZ=EST5EDT4
export TZ=PST8PDT7

And, as you would see in the links above, this has to be set BEFORE other commands. A good place to do this is with all the other export statements in rc.sysinit.author. Course, you could also go with the /etc/localtime approach. Requires more work, though, and it is system wide, which could be a good or bad thing.

bjarne
05-18-2004, 04:24 AM
Thank you, drnull for the fast reply. I used the export tz in the rc.sysinit.author and it works perfectly.

I spent some time searching, but wasn't smart enough to search for tz. I searched for cron, and came up with hundreds of hits, but none that applied to this.

drnull
05-18-2004, 04:39 AM
I spent some time searching, but wasn't smart enough to search for tz. I searched for cron, and came up with hundreds of hits, but none that applied to this.

Totally understood. I had to search for quite a while myself, and stumbled across the right answer more or less accidentally one day. It's easy to find it when you know the answer, though, and know what keywords to search for! :-)

JohnSorTivo
05-19-2004, 04:09 PM
export TZ=xxxDyyy[E]
This is incredibly valuable to use, not only in order to set your cron jobs up using your own time values, but in addition, without setting TZ in your sysinit file, you will have to manually adjust your cron jobs by 1 hour when daylight savings occurs...At least for us US folks.

Red_Dog
02-18-2008, 12:16 PM
The export TZ works great for cron, but some parts tivowebplus (2.1.b1) will be off by double the TZ shift. My TZ is 6 hours.

UI/ToDo & NPL show proper times.

"Higuide" shows a time bar 6 hours earlier than requested and the programs listed aired 6 hours before that!

"What's on" shows the hour that's 6 hours earlier than I asked, and the shows air 12 hours before the time I requested.

I found a solution.
I moved the "export TZ=xxxDyyy[E]" line so it's after the line that starts tivoweb
Now cron knows about TZ and tivoweb does not.

Red Dog