howto

OVZ Linux Containers

OpenVZ Linux Containers (CT) installation and management examples

Changing OpenVZ hostnames to a new pattern

For example, you have a list of VMs with the naming like role.domain.int. To change all of them to role.domain.net the following one-liner can be useful.

vzlist --all -H -o ctid,hostname| sed  's/\.int//' | awk '{system(" vzctl set " $1 " --hostname " $2".net --save")}'