seperating user timezones from system timezones

Chuck Swiger cswiger at mac.com
Sun Oct 5 11:02:23 PDT 2003


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




More information about the freebsd-questions mailing list