aboutsummaryrefslogtreecommitdiff
path: root/vzupdate.sh
blob: 2faeb858ee2c7739f17bbc61b8c45a6fd581a99d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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