Using rdist would be an easier way to do this if you have rdist on
your systems
rdist-file:
===============================
HOSTS = ( host1 host2
... hostn)
FILES = ( /etc/sysconfig/clock
/etc/localtime )
${FILES} -> ${HOSTS}
install;
=================================
Start from a patched system, you can
rdist -P /usr/bin/ssh -f rdist-file
rdist -P /usr/kerberos/bin/rsh -f rdist-file
if you have kerberos rsh enabled.
You can also instruct rdist-file to reboot after you successfully
install the files.
On Mar 7, 2007, at 10:37 AM, Mason Schmitt wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Brent L. Bates wrote:
I THOUGHT I had taken care of this, now I'm not so sure. I
downloaded
and installed the lastest tzdata RPM. `zdump -v' on the appropriate
/usr/share/zoneinfo file showed the correct information. I copied
the
zoneinfo file (/usr/share/zoneinfo/America/New_York) to /etc/
localtime and
thought that should fix everything.
This issue seems to be generating a lot of confusion for everyone
in IT.
It was actually a story on the news this morning. We have done our
update, so I thought I would put together a small how-to.
Here are a few steps that you can follow on all your linux hosts,
whether they are SL or not (in our case, redhat, mandrake and SL).
These were the steps that I did on our small network. On a larger
network, presumably you have other means of running commands across a
large number of hosts.
Note: 'hostlist' contains a list of all linux hosts on the
network. As
well, I use ssh keys to log into servers so that I'm not prompted for
passwords in these little scripts.
1 - Discover which timezone your servers are currently set to
- -------------------------------------------------------------
for host in `cat ~/hostlist`; do
echo $host;
ssh $host cat /etc/sysconfig/clock;
done
Your output should look like something like this. As you can see the
timezone for this computer is "Canada/Pacific"
<host>
UTC=true
ARC=false
ZONE=Canada/Pacific
2 - Update timezone data on all hosts
- -----------------------------------
Each server can be updated by simply copying over know good timezone
files, symlinking /etc/localtime to the appropriate timezone file and
rebooting the machine. In our case, I grabbed updated timezone files
from an SL4.4 box and copied them to all hosts. The files I copied
were:
/usr/share/zoneinfo/Canada/Pacific
and
/usr/share/zoneinfo/America/Vancouver.
If you have servers in several different timezones, you may want to
create a tarball with new zone info for all timezones listed in
/usr/share/zoneinfo/, copy that tarball to all hosts and overwrite the
old timezone data. Then, based on the output from the script in
section
one, you could automate the creation of a symlink from the appropriate
file in /usr/share/zoneinfo/ to /etc/localtime.
3 - Apply the changes
- ------------------------
The easiest way to ensure the changes are applied to all processes
that
use the locale settings, is a reboot. However, if you really want
to be
sure everything is correct before rebooting, you can confirm the
changes
by running a short little script something like this.
for host in `cat ~/hostlist`; do
echo -n "$host "
ssh $host "date -d 'March 11 2007 02:30' | awk '{print \$5}'"
done
Note: I used the date command as it actually uses /etc/localtime and I
can be much more specific about which time I want to see, than if I
were
to use zdump.
This script will spit out the timezone for each server. All our
servers
are in the Pacific timezone so I should expect to see PDT if all is
well. If a change did not apply correctly then I would see PST.
Even if you have servers in multiple timezones, they should all
indicate
they are in a daylight savings time timezone rather than a standard
time
zone, so greping for 'D' may be sufficient to know whether the
change is
correct or not.
Hopefully this is of use to someone and that no one has any issues
as a
result of the changeover this Sunday.
- --
Mason Schmitt
Systems Administrator
Sunwave Cable Internet / Shuswap Internet Junction
ph: (250) 832-9711
www.sunwave.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFF7wZfbip6upg8pq8RAnloAKCQrPAazE1Ryjwi38YsZjkphpCN9QCffLmG
+X+AZ8eoOHiW6d0qxTIzRfA=
=Id3e
-----END PGP SIGNATURE-----