diff options
Diffstat (limited to 'vzupdate.sh')
-rw-r--r-- | vzupdate.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/vzupdate.sh b/vzupdate.sh new file mode 100644 index 0000000..2faeb85 --- /dev/null +++ b/vzupdate.sh @@ -0,0 +1,21 @@ +#!/bin/sh +################################################################ +# Update Script for VZ Container on Debian based Distributions # +################################################################ + +VES=$( cat /proc/vz/veinfo | awk '{ print $1 }' ) + +[ -f /etc/debian_version ] || { echo "$0: not a debian based distro."; exit 1; } + +for ve in $VES; do + echo "-> UPDATE CT:$ve" + [ $ve -eq 0 ] && { apt-get update; apt-get upgrade; break; } + [ -r /etc/vz/conf/$ve.conf ] || { echo "$0: fail."; continue; } + + VEID=$ve + . /etc/vz/conf/$VEID.conf + [ -f $VE_PRIVATE/etc/debian_version ] || { echo "$0: CT$VEID is not a debian based distro."; continue; } + [ -z $NAME ] || echo "-> NAME $NAME" + + vzctl exec $VEID "apt-get update; apt-get -y upgrade;" +done
\ No newline at end of file |