Once a geek, forever a geek…

(OpenVZ) Setting timezones across all VPS`S

| 0 comments

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.

Related Posts

Author: Marius Voila

Hi! My name is Marius Voila, and I am a professional system administrator, system architect, and designer.

Leave a Reply

Required fields are marked *.

*