Subject: Re: date in cron emails
To: George Georgalis <george@galis.org>
From: Steven M. Bellovin <smb@cs.columbia.edu>
List: netbsd-users
Date: 03/02/2007 16:51:37
On Fri, 2 Mar 2007 13:45:37 -0500
"George Georgalis" <george@galis.org> wrote:

> On Fri, Mar 02, 2007 at 01:27:42PM -0500, Chuck Swiger wrote:
> >On Mar 2, 2007, at 1:21 PM, George Georgalis wrote:
> >>I'd like the local date on emails sent by cron
> >>(vs GMT).  Is there an env I can set or another
> >>straightforward solution?
> >
> >What happens if you set the TZ environment variable in the cron job?
> 
> #TZ=America/New_York
> #TZ=EST
> TZ=-500
> 
That's inside the script you invoke via cron, or perhaps in the crontab
itself?  I wouldn't expect those to work, since they wouldn't affect
cron's environment.

What is /etc/localtime?  If that's set properly, it should apply to all
programs, not just cron.  If you want a time zone setting for all cron
jobs but not the whole system, I think you can put something like

	TZ=EST5EDT; export TZ

in /etc/rc.conf.d/cron

I don't know any way to do that on a per-user basis.



		--Steve Bellovin, http://www.cs.columbia.edu/~smb