-if nsenter -t $RSPID -p -m -i -u ip netns exec $NAME chroot $LIVE /bin/sh \
- -c "for srv in $START ; do service \$srv stop ; done" ; then
- CHILDPIDS="$(nsenter -t $RSPID -p -m ps -hopid --ppid 1)"
- nsenter -t $RSPID -p -m kill $CHILDPIDS
-fi
+nsenter -t $RSPID -p -m -i -u \
+ ip netns exec $NAME chroot $(realpath $LIVE) \
+ /bin/sh -c "for srv in $START ; do service \$srv stop ; done"
+
+for p in $RSPID $USPID ; do
+ for S in 15 1 2 9 ; do
+ ps -hocmd $p || break
+ kill -$S $p
+ done
+done
+
+[ -r /run/netns/$NAME ] && ip netns del $NAME
+
+true