mariusv.com

Watch as I awkwardly stumble through life

(OpenVZ) Setting timezones across all VPS`S

Posted by Marius Voila on September 22, 2010 in London, U.K . — 0 comments This post contains 112 words

All of servers that I manage are currently based off of the Phoenix, Arizona, USA Timezone. This script allows this conversion from each HN (Host Node):

#!/bin/bash
for f in `ls /vz/private`
do
  vzctl exec $f rm -f /etc/localtime 2>/dev/null
  vzctl exec $f ln -s /usr/share/zoneinfo/America/Phoenix /etc/localtime
done

or :

for i in `vzlist | awk ‘{print $1} | grep -v CTID’`
do
vzctl exec $i rm -f /etc/localtime 2>/dev/null
vzctl exec $i ln -s /usr/share/zoneinfo/America/Phoenix /etc/localtime
done

Because /vz/private may hold disabled/suspended/shutdown containers or even random directories.