Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

ExecuteInAllVEs

36 bytes added, 18:44, 3 January 2008
no edit summary
<code>
#!/bin/bash CONFDIR="/etc/vz/conf" if [ "$1" == "" ]; then echo "$0 -- Execute a command on all VEs" echo "" echo "Example: vzexec service httpd restart" echo "" echo "Note that variables are expanded in the host's shell, and use '' to prevent this." echo "Example: vzexec echo \$PWD and vzexec 'echo \$PWD' are different." exit fi for veconf in $CONFDIR/*.conf ; do veid=`basename $veconf .conf` if [ "$veid" == "0" ]; then continue; fi vename=`grep ^NAME $veconf | head -1 | sed -e 's@NAME=@@' | sed -e 's@"@@g'` echo "*** VE $veid ($vename)" vzctl exec $veid $@ done
</code>
24
edits