Timezone

From OpenVZ Virtuozzo Containers Wiki
Revision as of 00:20, 17 February 2007 by Mh720 (talk | contribs) (New page: Time difference between Hardware Node and VPS During the distribution (redhat/centos) installer, you choose the timezone for your HN. The VE template has its own preconfigured timezone. S...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Time difference between Hardware Node and VPS

During the distribution (redhat/centos) installer, you choose the timezone for your HN. The VE template has its own preconfigured timezone. So, its very possible for the zones to differ.


To resolve the problem, You should configure your VE to have the same timezone as the HN. For example, if EST is your preferred timezone:

rm -rf /etc/localtime 2>/dev/null; unlink /etc/localtime 2>/dev/null ln -s /usr/share/zoneinfo/EST /etc/localtime vzctl exec 1041 rm -rf /etc/localtime 2>/dev/null vzctl exec 1041 unlink /etc/localtime 2>/dev/null vzctl exec 1041 ln -s /usr/share/zoneinfo/EST /etc/localtime


You can find many more exciting timezones with:

find /usr/share/zoneinfo/ | more


Or, here is a shell script that will let you change the timezones in ALL of your VPS's:

  1. ! /bin/bash

for f in `ls /vz/private` do vzctl exec $f rm -rf /etc/localtime 2>/dev/null vzctl exec $f unlink /etc/localtime 2>/dev/null vzctl exec $f ln -s /usr/share/zoneinfo/CST6CDT /etc/localtime done