Release.
[safe/jmp/vzgot] / shell / vzgot.close
1 #! /bin/sh
2 #----------------------------------------------------
3 #shell used to clean the host part (network, cgroup)
4 #while stopping a vzgot Virtual Host
5 #This shell is called from the vzgot executable
6 #
7 #----------------------------------------------------
8 #Syntaxe
9 #vzgot.open VE_name VE_pid [base_dir]
10 #       VE_name is the container dir name
11 #       VE_pid is the container main process ID as seen
12 #       by the host
13 #       base_dir is this application root directory
14 #       used for devel only.
15 #----------------------------------------------------
16 CONTNAME=$1
17 VEPID=$2
18 BASE=$3
19 #----------------------------------------------------
20 if ! [ -f $BASE/etc/vzgot/vzgot_config ] ; then
21   echo "Missing vzgot config file"
22   exit 1        #trouble trouble
23   fi
24 . $BASE/etc/vzgot/vzgot_config
25
26 #specific container configuration override (if needed)
27 if [ -f $BASE/$VZLIB/vzdir/$CONTNAME/vzgot_config ] ; then
28   $BASE/$VZLIB/vzdir/$CONTNAME/vzgot_config
29   fi
30 #----------------------------------------------------
31 #lets cancel all routing
32 $BASE/$VZLIB/shell/vzgot.net $CONTNAME remove $BASE
33 #----------------------------------------------------
34 #Using cgroup if available and operational
35 if [ -f $CGROUP/tasks ] ; then
36   rm -fr $BASE/$VZLIB/vzdir/$CONTNAME/cgroup
37   rmdir $CGROUP/$VEPID
38   fi
39 exit 0