How to set TZ for cron?

How to set TZ for cron?

Post by Markus N. Richards » Tue, 02 Oct 1990 21:09:00



We are having problems *encouraging* cron to accept our (PST8PDT) timezone.
So far we have done the following to try to alleviate the problem:

Placed the line "TZ=PST8PDT; export TZ" at the beginning of /etc/rc
Placed the line "TZ=PST8PDT; export TZ" at the beginning of /etc/profile
Placed the line "setenv TZ PST8PDT" in /etc/cshprofile (our csh startup file)

None of these have solved the problem.  All cron jobs still execute based
on the default timezone (EST)!  Any good ideas?

FYI, we are running 5v2r2 UNIX.  Please e-mail any responses as this is
(hopefully :-) a simple problem that probably has been hashed out before.
Thanks in advance.
--

        Markus N. Richardson
        Research and Development
        Eaton Corporation IMSD
        Westlake Village, CA 91359

        { voder,ihnp4,trwrb,scgvaxd,jplgodo }!wlbr!etn-rad!markus

 
 
 

How to set TZ for cron?

Post by b.. » Tue, 02 Oct 1990 11:05:00


put the TZ in the shell script that cron executes.

 
 
 

How to set TZ for cron?

Post by Paul Vix » Tue, 02 Oct 1990 13:39:00



>We are having problems *encouraging* cron to accept our (PST8PDT) timezone.
>So far we have done the following to try to alleviate the problem:

My Cron (PD) allows TZ (and any other env vars of your choice) to be set in
each crontab (one per user, for you BSD-only folks).  Cron does not use the
variable itself, in interpreting time ranges in the crontabs; however, all
processes created by cron will inherit the proper value.  Letting TZ
differ on a per-crontab basis is of questionable use, but that's how it is..

Vixie's PD Cron is available via mail from several sources - it was posted
to comp.sources.misc some months back, and that group is not officially
archived.  I need to rewrite it quite a bit, which is why it didn't go into
comp.sources.unix...

It also needs to be ported to SysV - that's right, it's BSD-only at present.
I was hoping that someone else would do this, but it looks like it's up to
me.  It shouldn't be much work, though - a few hours at most.  (Hint Hint -
I don't have a SysV machine, so testing is hard!)
--
Paul Vixie

Ungermann-Bass          Home: 415-647-7023      ames!pyramid!ubvax!vix
Santa Clara, CA         <<I do not speak for Ungermann-Bass>>

 
 
 

How to set TZ for cron?

Post by John Michael Mulli » Tue, 02 Oct 1990 13:54:00



Quote:

> We are having problems *encouraging* cron to accept our (PST8PDT) timezone.
> So far we have done the following to try to alleviate the problem:
> [edited]
> None of these have solved the problem.  All cron jobs still execute based
> on the default timezone (EST)!  Any good ideas?

We had the same problem at our site.  This function did work under System III,
but after much phone time with AT&T support, they say the TZ variable is not
a supported function of cron.

My opinion of the situation is that it was intended to be supported, but it's
one of those problem bugs that someone made an executive decision "to let it be"

One of the things I noticed about this bug, or "lack of feature" is that when I
try to set the TZ variable as you mentioned, the actual time reported by the
executed program, is not consistent.  One day it will execute at 2100, report
that the time is 0600, then the next day, it will again run at 2100, but the
reported time may be 0820 (or something equally off the wall).

Unless someone with source knows better, I would say you/we are stuck on this.

--
John Michael Mullins
CENTEL Business Information Systems, Inc.
5515 Security Lane, Rockville, Maryland, 20852, (301) 984-3636

 
 
 

How to set TZ for cron?

Post by Robert C. White J » Tue, 02 Oct 1990 22:19:00




> > [Timezone Problem in AT&T UNIX]
> [An echo of the above, with refrences to bad Customer service]

        Our [the only one at the time] 3B2 had the same problem.
I work fairly closley with some AT&T people, and was told that
the cron thing had been overlooked for SVR2 or below.  The newest
releases SVR3.1 [I dont know about 3.0] support TZ Correctly.  There
were several TZ munges in cron.  As near as I could figure, the older
cron just does not deal with it's environment at all.

My fix was to prepend . /etc/TIMEZONE ; to every cron line and add
three hours to the hours field [when used]  It's ugly, but the
programs [especially uudemon.hour (as in poll)] appreciate the
prepend greatly.

[Now if only the one vendor we are having problems with would
certify a 3.0 or better release of it's software]

Rob.

 
 
 

1. cron, GMT and TZ

I just installed a new Intel box with Redhat 6.0 for my web server.  It had
been running on a slower box running Redhat 5.2.

What I've noticed is that when I installed the 5.2 system, I set the clock
to pacific time, my local timezone.  When I installed the 6.0 system, I went
with the "more correct" scheme of setting the clock to GMT, and now I'm
using the TZ to get the clock to show my time correctly (I'll have to check,
but I think TZ=8PDT8 is incorrect, but working right now!).

Two issues popped up.

1) My SQL database stored TIMESTAMPs, and these all seem to be adjusted on
the new system based on the GMT.  I presume this occurred because they are
stored as seconds from 1970 GMT, and the clock switch tricked them.  At the
very worst, I can reset all the timestamps fields by adding 8 hours to them.

2) cron. What does cron use for time?  It seems that it is running on GMT
also, but that's a real pain in my mind.  Do most people schedule cron jobs
to run with GMT, or is there a way to trick cron into using the times in the
/etc/crontab and the personal crontabs as if they were local time?  Can I
just set TZ in the /etc/rc.d/init.d/crond file before it starts it, or put
TZ into the /etc/crontab file?  Anybody know for sure?

Thanks,
David

---------------------------------------------
David A. E. Wall
myEastside.com
http://myEastside.com

2. Need help, cannot access /~users/

3. Dumb newbie mistake setting up TZ and clock

4. FAX & USR: again

5. How do you set global TZ on 2.5.x ?

6. loose Virtual from fvwm?

7. TZ setting of Hongkong ?

8. KDM

9. UW213 - mailsurr - setting correct date based on TZ on outgoing mails

10. TIMEZONE (TZ) not set

11. Setting the TZ at aix.4.1.5

12. TZ setting of Hongkong ?

13. ftpd + chrooted client =TZ not set