Setting the Timezones across all VPS’s (OpenVZ)

All of our servers 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

1 Comment so far »

  1. vpsnoc said

    February 25 2010 @ 12:48 pm

    I believe a safer way of doing this would be

    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.

Comment RSS · TrackBack URI

Leave a comment

Name: (Required)

Email: (Required)

Website:

Comment: