Un petit script tres simple pour effectuer une commande sur toute les CT
vzexec.sh
#!/bin/bash
#
# vzexec.sh
#
# Christian VALLEE <cv@valtechnologie.com>
# PATH=$PATH:/usr/sbin#
# DO NOT MODIFY AFTER THIS LINE !!!
#
VZLIST=”$(which vzlist)”
VZCTL=”$(which vzctl)”
SILENTMODE=OFF
function log {
if [ $SILENTMODE = “OFF” ] then
echo “[” `date “+%Y-%m-%d %H:%M:%S”` “] $1”
fi
}
#
# vzexec.sh
#
# Christian VALLEE <cv@valtechnologie.com>
# PATH=$PATH:/usr/sbin#
# DO NOT MODIFY AFTER THIS LINE !!!
#
VZLIST=”$(which vzlist)”
VZCTL=”$(which vzctl)”
SILENTMODE=OFF
function log {
if [ $SILENTMODE = “OFF” ] then
echo “[” `date “+%Y-%m-%d %H:%M:%S”` “] $1”
fi
}
case $1 in
-q) SILENTMODE=ON ; shift ;;
esac
# process all CT
for CT in `$VZLIST -Ho veid`; do
log “Execute $* on CT $CT…”
$VZCTL exec $CT $*
log “Command done.”
done
# end of script