Re: Scripted method to change TZ from UTC to a specific timezone?
- From: "Boyd Stephen Smith Jr." <bss@xxxxxxxxxxxxxxxxx>
- Date: Fri, 15 Oct 2010 11:14:08 -0500
On Friday 15 October 2010 10:45:27 James Wu wrote:
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.
Depends on what frontend you use.
I've tried the following methods without success:
"cp /usr/share/zoneinfo/America/New_York /etc/timezone"
Wrong file. /etc/timezone is just cosmetic, AFAIK. The target of your cp
command should have been /etc/localtime.
+ changing
"UTC=yes to UTC=no" in /etc/default/rcS
From what I understand, that only affect where
I've also tried "echo 'America/New_York' > /etc/timezone" as well
instead of copying.
You might also want to do this, but /etc/localtime and /etc/timezone provide
different information. /etc/localtime is machine-readable data that allows
libc to map UTC times to local times; /etc/timezone is (I guess) the human-
readable name of the local time.
You shouldn't need to reboot; updates to /etc/localtime and /etc/timezone are
automatically picked up by libc.
Is there another way to change the tzdata from
UTC without requiring user input?
debconf-set-selections < $some_configs_in_a_file
dpkg-reconfigure -fnoninteractive "$changed_packages[@]"
Maybe?
--
Boyd Stephen Smith Jr. ,= ,-_-. =.
bss@xxxxxxxxxxxxxxxxx ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-'
http://iguanasuicide.net/ \_/
Attachment:
signature.asc
Description: This is a digitally signed message part.
- Follow-Ups:
- References:
- Prev by Date: Re: Debian Ciel -- A Theme Proposal for Squeeze
- Next by Date: Re: Scripted method to change TZ from UTC to a specific timezone?
- Previous by thread: Scripted method to change TZ from UTC to a specific timezone?
- Next by thread: RE: Scripted method to change TZ from UTC to a specific timezone?
- Index(es):
Relevant Pages
|