summaryrefslogtreecommitdiff
blob: b6f446fba7acfe2c756ef2c9324c34f1fe3cebd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
diff -NurpP util-vserver-0.30.210/scripts/vserver util-vserver-0.30.210-delete/scripts/vserver
--- util-vserver-0.30.210/scripts/vserver	2005-10-28 20:29:00.000000000 +0200
+++ util-vserver-0.30.210-delete/scripts/vserver	2006-03-12 08:21:19.293748750 +0100
@@ -43,6 +43,7 @@ Possible commands are:
     restart     ... restarts the specified vserver; this is the subsequent
                     execution of a synchronized 'stop' and a 'start'
     condrestart ... restarts the vserver when it is running already
+    delete      ... deletes the specified vserver
     suexec <user> <shell-command> <args*>
                 ... executes a command as the specified user in the vserver
     exec <shell-command> <args*>
@@ -96,6 +97,17 @@ the GNU General Public License.  This pr
     exit 0
 }
 
+function delete()
+{
+    if [[ -z "$OPTION_SILENT" ]]; then
+        read -p "Really remove '$vserver'? [y/N]" deleteok
+	[[ "$deleteok" != [Yy] ]] && exit 2
+    fi
+    
+    isVserverRunning "$VSERVER_DIR" && "${SELF[@]}" $OPTION_SILENT --sync "$vserver" stop
+    rm -rf $(readlink -f "$VSERVER_DIR"/vdir) "$VSERVER_DIR"
+}
+
 function suexec()
 {
     . $__PKGLIBDIR/vserver.suexec
@@ -203,7 +215,7 @@ case "$2" in
 	shift 2
 	. $__PKGLIBDIR/vserver.$cmd
 	;;
-    (suexec|restart)
+    (suexec|restart|delete)
 	shift 2
 	$cmd "$@"
 	;;