summaryrefslogtreecommitdiff
path: root/contrib/scripts/netjail/netjail_core.sh
diff options
context:
space:
mode:
authorTheJackiMonster <thejackimonster@gmail.com>2021-05-02 22:00:28 +0200
committerTheJackiMonster <thejackimonster@gmail.com>2021-05-02 22:00:28 +0200
commitae33e8ca07ba8cb72d9823b5137aeeb93bd2056c (patch)
tree87272635dc112d914cf37aa49dcd7770cc921019 /contrib/scripts/netjail/netjail_core.sh
parent2a027d304a09fa9645cb7e121a2650085328fb6c (diff)
-corrected sub-process cleanup for netjail
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat (limited to 'contrib/scripts/netjail/netjail_core.sh')
-rwxr-xr-xcontrib/scripts/netjail/netjail_core.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/contrib/scripts/netjail/netjail_core.sh b/contrib/scripts/netjail/netjail_core.sh
index 8dbbeacf1..a3271a3e4 100755
--- a/contrib/scripts/netjail/netjail_core.sh
+++ b/contrib/scripts/netjail/netjail_core.sh
@@ -126,4 +126,13 @@ netjail_node_exec() {
unshare -fp --kill-child -- ip netns exec $NODE sudo -u $JAILOR -- $@ 1>& $FD_OUT 0<& $FD_IN
}
+netjail_kill() {
+ PID=$1
+
+ for CHILD in $(ps -o pid,ppid -ax | awk "{ if ( \$2 == $PID ) { print \$1 } }"); do
+ netjail_kill $CHILD
+ done
+
+ kill $PID
+}