OpenVZ containers really changed my way of using virtual machines. It has a lot of pros and only a few cons.

One of these pros is the ability to execute a command on a container directly from the host. For example, to reboot container 102:

This  command is very, very powerful. For example, I use this one to apt-get update all my running containers:

Where “vzlist -H -o ctid” displays a list of all running containers (see here for more).

Handy, isn’t it? but wait, there is more! I host a CT for a friend and I let him plan his updates whenever he want, all by himself. So I created this lil’ script to help it out:

Here all containers whom numbers are in “avoid” list will not be affected.

Source: Stackoverflow: iterate over an array and avoid a value