Scripted method to change TZ from UTC to a specific timezone?



Hi all,

When I run the cmd "date", I get UTC time on a fresh boot of an imaged
machine. I'd like to find a way to set the time to "America/New_York"
for automatically via script. A reboot is ok if absolutely needed but
not preferred.

I'm aware that I can run "dpkg-reconfigure tzdata" but that requires
user input.

I've tried the following methods without success:
"cp /usr/share/zoneinfo/America/New_York /etc/timezone" + changing
"UTC=yes to UTC=no" in /etc/default/rcS
I even tried rebooting afterwards
I've also tried "echo 'America/New_York' > /etc/timezone" as well
instead of copying.

Am I missing something? Is there another way to change the tzdata from
UTC without requiring user input?

Cheers,
James



Relevant Pages

  • Re: Timezone problem
    ... Time settings do not need reboot after configuration change. ... most of them would let you pick either local or utc time. ... Maybe it's picking up UTC from BIOS? ...
    (RedHat)
  • Re: Scripted method to change TZ from UTC to a specific timezone?
    ... On Friday 15 October 2010 10:45:27 James Wu wrote: ... for automatically via script. ... A reboot is ok if absolutely needed but ... UTC without requiring user input? ...
    (Debian-User)
  • RE: RH9 Time of day erroneously changes 5 hours at reboot
    ... YOu may have your system set for UTC time, ... or the TZ environmental variable may be incorrect. ... If you are on the east coast of usa, ... > Oct 1 of this year, each time we reboot the system, the time ...
    (RedHat)
  • RE: Timezone problem
    ... Time settings do not need reboot after configuration change. ... most of them would let you pick either local or utc time. ... > different state than server. ...
    (RedHat)
  • Re: 10.4.6 is out, and so are the...
    ... Only user input my Suse box needs to update is the admin password. ... Reboot? ...
    (comp.sys.mac.advocacy)