3 # userdel(8) wrapper for vservers
5 # Copyright (c) 2004 The Trustees of Princeton University (Trustees).
7 # $Id: vuserdel,v 1.11 2007/06/29 14:13:01 dhozac Exp $
10 : ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
11 test -e "$UTIL_VSERVER_VARS" || {
12 echo "Can not find util-vserver installation; aborting..."
15 . "$UTIL_VSERVER_VARS"
24 [ "$1" == "--static" ] && { STATIC=yes; shift; }
27 # read config file to get context ID
28 CTX=`cat $__CONFDIR/$NAME/context`
30 # don't bother stopping gracefully, just kill all the processes
31 chcontext --silent --secure --ctx $CTX $__LEGACYDIR/vserverkillall
33 # unmount any directories in vserver that are mount points
34 for d in `sed -ne "s%^[^ ]* \($__DEFAULT_VSERVERDIR/$NAME/[^ ]*\) .*%\1%p" /proc/mounts`
36 # use echo -e to turn escaped whitespace back into regular chars
37 # be careful about embedded backquotes here (i think we're safe)
39 echo "unmounting $dir"
44 [ -z "$STATIC" ] && userdel -r $NAME
46 # remove vserver configuration directory
47 rm -rf /etc/vservers/$NAME
49 # remove vserver profile
50 rm -f /var/run/vservers/$NAME.ctx
53 if [ -d $__DEFAULT_VSERVERDIR/$NAME ] ; then
54 TMP=$(mktemp -d "$__DEFAULT_VSERVERDIR/.vtmp/$NAME.XXXXXX")
55 mv "$__DEFAULT_VSERVERDIR/$NAME" "$TMP"