Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 05 Oct 2003 14:02:16 -0400
From:      Chuck Swiger <cswiger@mac.com>
To:        freebsd@kibserv.org
Cc:        freebsd-questions@freebsd.org
Subject:   Re: seperating user timezones from system timezones
Message-ID:  <3F805CA8.7010408@mac.com>
In-Reply-To: <1065316286.850.30.camel@butters>
References:  <1065316286.850.30.camel@butters>

next in thread | previous in thread | raw e-mail | index | archive | help
Mailing Lists Catcher wrote:
> How to I allow users access to their own timezone without affecting the
> system processes?
> 
> All of my systems regardless of location have always been set to UTC so
> logs and cron are in sync across timezones.

Hmm.  Unix has understood the notion of 'local time' versus UTC and most 
programs do the right thing even if you set the timezone for the entire 
system-- things like ntpd will syncronize via UTC even if TZ was set in their 
environment.

If you want to run syslogd and cron in UTC, I believe you could do so by 
setting something like this in /etc/rc.conf:

cron_program='/usr/bin/env TZ=UTC /usr/sbin/cron'
syslogd_program='/usr/bin/env TZ=UTC /usr/sbin/syslogd'

> Recently I have had need to allow users to set their own timezone in the
> .cshrc using:
> sentenv TZ America/Detroit
> or
> sentenv TZ America/Denver
> or whatever applies.

Of course, you meant 'setenv' and not 'sentenv'.

> But what I am finding out is that as long as the user is logged in it
> sets the environment for the entire system affecting log timestamps as
> well as cron events.

Unless you set TZ in /etc/profile, it should not have a universal effect.  Are 
you sure you didn't kill and restart syslogd as root with TZ configured to a 
non-UTC timezone?

Maybe try setting TZ only if the shell is interactive, by adding the setenv 
after the line "if ($?prompt) then"...?

-- 
-Chuck




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F805CA8.7010408>