NickTheGreek 160 Report post Posted January 29, 2017 Execute a command in all running OpenVZ Containers If you wish to execute a command in all running Containers, you can use the following script: for i in `cat /proc/vz/veinfo | awk '{print $1}'|egrep -v '^0$'`; \ do echo "Container $i"; vzctl exec $i <command>; done where <command> is the command to be executed in all the running Containers. For example: for i in `cat /proc/vz/veinfo | awk '{print $1}'|egrep -v '^0$'`; \ do echo "Container $i"; vzctl exec $i uptime; done Container 12:26pm up 6 days, 1:28, 0 users, load average: 0.00, 0.00, 0.00Container 1012:26pm up 6 days, 1:39, 0 users, load average: 0.00, 0.00, 0.00 Source: http://download.swsoft.com/virtuozzo/virtuozzo4.0/docs/en/lin/VzLinuxUG/260.htm 2 Quote Share this post Link to post Share on other sites