summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xvserver.netns9
-rw-r--r--vservers-default31
2 files changed, 31 insertions, 9 deletions
diff --git a/vserver.netns b/vserver.netns
index 713f6c8..8e55c02 100755
--- a/vserver.netns
+++ b/vserver.netns
@@ -123,7 +123,14 @@ if [[ "$ACTION" != "stop" ]]; then
fi
-# stop need to do something after the stop, so no exec here
+# ACTION = stop: if namespace does not exists anymore,
+# do not try to execute vserver in it
+if ! $_IP netns list | grep -q "^$VSERVER_NAME\$"; then
+ exec "$_REAL_VSERVER" "${ARGS[@]}"
+fi
+
+
+# ACTION = stop: need to do something after the stop, so no exec here
"${NETNS[@]}" "$_REAL_VSERVER" "${ARGS[@]}"
ret=$?
diff --git a/vservers-default b/vservers-default
index b2ca484..51e5ca4 100644
--- a/vservers-default
+++ b/vservers-default
@@ -16,16 +16,31 @@ fi
name="$(basename "$0")"
# This is a requirement, stated in the init script. So we set it
-# here, to not confuse the user.
+# here, to not bother the user.
LOCKFILE="$name"
-function _get_flavor() {
- local flavor=""
- if [ "$name" = "${name#vserver-default[-.]}" ]; then
-
- else
- fi
-}
+
+# Include default configuration
+if [[ -r "/etc/vservers/.defaults/apps/vserver-startup/default" ]]; then
+ . "/etc/vservers/.defaults/apps/vserver-startup/default"
+fi
+
+
+# Include special configuration for initscript
+if [ "$name" = "${name#vserver-default[-.]}" ]; then
+ falvor="${name#vserver-default[-.]}"
+else
+ flavor="${name#vserver[-.]}"
+fi
+
+if [[ "default" != "$flavor" &&
+ -r "/etc/vservers/.defaults/apps/vserver-startup/$flavor" ]]; then
+ . "/etc/vservers/.defaults/apps/vserver-startup/$flavor"
+fi
+
+unset flavor
+unset name
+
# Added the ability to disable a flaver without disabling the
# initscript. (Debian enables all initscripts during installation