#! /bin/sh #---------------------------------------------------- #shell used to remove the root file system for a #container. # #---------------------------------------------------- #Syntaxe #vzgot.destroy VE_name # VE_name is the container dir name # base_dir is this application root directory # used for devel only. #---------------------------------------------------- CONTNAME=$1 BASE=$2 #---------------------------------------------------- if ! [ -f $BASE/etc/vzgot/vzgot_config ] ; then echo "Missing vzgot config file" exit 1 #trouble trouble fi . $BASE/etc/vzgot/vzgot_config #specific container configuration override (if needed) if [ -f $BASE/$VZLIB/vzdir/$CONTNAME/vzgot_config ] ; then $BASE/$VZLIB/vzdir/$CONTNAME/vzgot_config fi #---------------------------------------------------- if [ ! -d $BASE/$VZLIB/vzdir/$CONTNAME ] ; then echo "Container $CONTNAME not existing" exit 1 fi #---------------------------------------------------- #checking if container is up and running if [ -f $BASE/$VZLIB/vzdir/$CONTNAME/first.pid ] ; then echo "Container $CONTNAME is up and running" echo "Container must be stop first, try \"vzgot shutdown $CONTNAME\"" exit 2 fi #---------------------------------------------------- if [ ! -z "$LVM" ] ; then VZCONTNAME=`echo $CONTNAME | sed 's/\.//g' | sed 's/-//g'` umount $BASE/$VZLIB/vzdir/$CONTNAME sed -i -e/"vzdir\/$CONTNAME"/d /etc/fstab lvremove --quiet -f /dev/$LVM/$VZCONTNAME > /dev/null 2>&1 ret=$? if [ $ret -ne 0 ]; then echo "vzgot.destroy, unable to destroy LVM $VZCONTNAME with lvremove" exit $ret fi fi mv $BASE/$VZLIB/vzdir/$CONTNAME $BASE/$VZLIB/vzdir/$CONTNAME.$$ rm -fr $BASE/$VZLIB/vzdir/$CONTNAME.$$ & exit 0