From 76e5eeea3fed953a418d1fe43f904b88d4784d93 Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 5 Feb 2023 00:00:18 +0000 Subject: [PATCH] prisonparty: fix reload signal --- bin/prisonparty.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/prisonparty.sh b/bin/prisonparty.sh index b8ed2c9c..f6336d72 100755 --- a/bin/prisonparty.sh +++ b/bin/prisonparty.sh @@ -97,9 +97,11 @@ done cln() { rv=$? - # cleanup if not in use - lsof "$jail" | grep -qF "$jail" && - echo "chroot is in use, will not cleanup" || + wait -f -p rv $p || true + cd / + echo "stopping chroot..." + lsof "$jail" | grep -F "$jail" && + echo "chroot is in use; will not unmount" || { mount | grep -F " on $jail" | awk '{sub(/ type .*/,"");sub(/.* on /,"");print}' | @@ -124,5 +126,6 @@ export LOGNAME="$USER" #echo "cpp [$cpp]" chroot --userspec=$uid:$gid "$jail" "$pybin" $pyarg "$cpp" "$@" & p=$! +trap 'kill -USR1 $p' USR1 trap 'kill $p' INT TERM wait