Unix Technical Forum

changing the timezone on a live system

This is a discussion on changing the timezone on a live system within the comp.unix.solaris forums, part of the Solaris Operating System category; --> Anyone know how to change the timezone settings on a live system w/o rebooting? Anything I could possibly force ...


Go Back   Unix Technical Forum > Unix Operating Systems > Solaris Operating System > comp.unix.solaris

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-11-2008, 01:55 PM
Rodrick Brown
 
Posts: n/a
Default changing the timezone on a live system

Anyone know how to change the timezone settings on a live system w/o
rebooting?
Anything I could possibly force through mdb etc..

Thanks.

--
Rodrick R. Brown
Senior IT Consultant
http://www.rodrickbrown.com
rodrick.brown[<@>]gmail.com

When in 1986 Apple bought a Cray X-MP and announced that they would use it
to design the next Apple Macintosh, Seymour Cray replied, "This is very
interesting because I am using an Apple Macintosh to design the Cray-2
supercomputer."


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-11-2008, 01:55 PM
Richard B. Gilbert
 
Posts: n/a
Default Re: changing the timezone on a live system

Rodrick Brown wrote:

> Anyone know how to change the timezone settings on a live system w/o
> rebooting?
> Anything I could possibly force through mdb etc..
>
> Thanks.
>


Even if it's possible, I suspect it would be much easier to reboot.

The timezone is set in the TZ environment variable for each process. As
far as I know, there is no way to reset those environment variables
without stopping and restarting every process.

You may be able to solve your problem by stopping and restarting a few
processes where the timezone really matters.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-11-2008, 01:56 PM
Ken Gray
 
Posts: n/a
Default Re: changing the timezone on a live system

In article <mAs%f.28015$cY3.2863@news-wrt-01.rdc-nyc.rr.com>,
"Rodrick Brown" <rodrick.brown@gmail.com> wrote:

> Anyone know how to change the timezone settings on a live system w/o
> rebooting?
> Anything I could possibly force through mdb etc..
>
> Thanks.


Very dangerous - consider init, which is started at boot, and everything
it starts. How do you convince it that the TZ has changed without
stopping and restarting it? Reboot is your only option. Not doing so
will cause grief with daemons, etc.

--
Ken

Real address krgray*at*verizon*dot*net
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-11-2008, 01:56 PM
Darren Dunham
 
Posts: n/a
Default Re: changing the timezone on a live system

Ken Gray <see-sig-for-address@nowhere.invalid> wrote:
> In article <mAs%f.28015$cY3.2863@news-wrt-01.rdc-nyc.rr.com>,
> "Rodrick Brown" <rodrick.brown@gmail.com> wrote:


>> Anyone know how to change the timezone settings on a live system w/o
>> rebooting?
>> Anything I could possibly force through mdb etc..


> Very dangerous - consider init, which is started at boot, and everything
> it starts. How do you convince it that the TZ has changed without
> stopping and restarting it? Reboot is your only option. Not doing so
> will cause grief with daemons, etc.


True, but init may not be that big a deal. By restarting and setting
cron, inetd, ssh, and any running apps (oracle, apache, etc.) I'd have
99% of the stuff done. I don't expect much other than the console login
session to get started by init under pre-solaris 10.

--
Darren Dunham ddunham@taos.com
Senior Technical Consultant TAOS http://www.taos.com/
Got some Dr Pepper? San Francisco, CA bay area
< This line left intentionally blank to confuse you. >
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-11-2008, 01:56 PM
Casper H.S. Dik
 
Posts: n/a
Default Re: changing the timezone on a live system

"Richard B. Gilbert" <rgilbert88@comcast.net> writes:

>The timezone is set in the TZ environment variable for each process. As
>far as I know, there is no way to reset those environment variables
>without stopping and restarting every process.


One possible trick is to set $TZ to "localtime" and use "zic -l".

>You may be able to solve your problem by stopping and restarting a few
>processes where the timezone really matters.


That is the only possible solution.

Casper
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 01-11-2008, 01:56 PM
Casper H.S. Dik
 
Posts: n/a
Default Re: changing the timezone on a live system

Darren Dunham <ddunham@redwood.taos.com> writes:

>True, but init may not be that big a deal. By restarting and setting
>cron, inetd, ssh, and any running apps (oracle, apache, etc.) I'd have
>99% of the stuff done. I don't expect much other than the console login
>session to get started by init under pre-solaris 10.


Don't forget syslogd. Perhaps we need to reload "TZ" in the
standard SMF scripts.

But the "TZ=localtime" trick works for an ordinary restart where
TZ is unchanged.

(TZ is not reloaded even if the TZ file changes)

Casper
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 01-11-2008, 01:56 PM
Stephane Chazelas
 
Posts: n/a
Default Re: changing the timezone on a live system

On Thu, 13 Apr 2006 13:43:46 GMT, Rodrick Brown wrote:
> Anyone know how to change the timezone settings on a live system w/o
> rebooting?
> Anything I could possibly force through mdb etc..

[...]

You may try and change the timezone of a live process this way:

example of a live process:

$ perl -MPOSIX -le 'while(1) {print strftime("%c",localtime); sleep 1}'
Fri Apr 14 13:22:11 2006
Fri Apr 14 13:22:12 2006
Fri Apr 14 13:22:13 2006
Fri Apr 14 13:22:14 2006

~$ pgrep -x perl
2350
~$ gdb /usr/local/bin/perl
(gdb) attach 2350
(gdb) call putenv("TZ=GMT+10")
$1 = 0
(gdb) detach
Detaching from program: /usr/local/bin/perl LWP 1
(gdb) quit
~$ kill -ALRM 2350

Fri Apr 14 02:22:40 2006
Fri Apr 14 02:22:41 2006
Fri Apr 14 02:22:42 2006
Fri Apr 14 02:22:43 2006
Fri Apr 14 02:22:44 2006
Fri Apr 14 02:22:45 2006

I had to send a SIGALRM to the process or the sleep(1) would
never return, you won't need that with every process, it worked
seemlessly with xclock. This is not guaranteed to work with
every process.

And that stops the process for some time. You can make that time
short if you use of a gdb script.

--
Stephane
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:52 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com