summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xvserver.netns14
1 files changed, 13 insertions, 1 deletions
diff --git a/vserver.netns b/vserver.netns
index 8d9e244..c507621 100755
--- a/vserver.netns
+++ b/vserver.netns
@@ -143,7 +143,19 @@ if [ -n "${_USE_NETNS}" ]; then
_processSingleNetwork remove "$net"
done
- $_IP netns delete "$VSERVER_NAME"
+ procs="$($_IP netns exec "$VSERVER_NAME" netstat -tulpenW | sed '1d;2d')"
+ if [ -n "$procs" ]; then
+ echo "There are still processes active in the network namespace:"
+ echo "$procs"
+ echo
+ echo "Deleting of the network namespace would produce a bad state."
+ echo "So we DO NOT delete the network namespace. You maybe want
+ echo "to kill the processes and execute the following commands:"
+ echo " $_IP netns exec \"$VSERVER_NAME\" netstat -tulpen"
+ echo " $_IP netns delete \"$VSERVER_NAME\""
+ else
+ $_IP netns delete "$VSERVER_NAME"
+ fi
fi
exit $ret