prisonparty: fix reload signal

This commit is contained in:
ed 2023-02-05 00:00:18 +00:00
parent eb17f57761
commit 76e5eeea3f

View file

@ -97,9 +97,11 @@ done
cln() { cln() {
rv=$? rv=$?
# cleanup if not in use wait -f -p rv $p || true
lsof "$jail" | grep -qF "$jail" && cd /
echo "chroot is in use, will not cleanup" || echo "stopping chroot..."
lsof "$jail" | grep -F "$jail" &&
echo "chroot is in use; will not unmount" ||
{ {
mount | grep -F " on $jail" | mount | grep -F " on $jail" |
awk '{sub(/ type .*/,"");sub(/.* on /,"");print}' | awk '{sub(/ type .*/,"");sub(/.* on /,"");print}' |
@ -124,5 +126,6 @@ export LOGNAME="$USER"
#echo "cpp [$cpp]" #echo "cpp [$cpp]"
chroot --userspec=$uid:$gid "$jail" "$pybin" $pyarg "$cpp" "$@" & chroot --userspec=$uid:$gid "$jail" "$pybin" $pyarg "$cpp" "$@" &
p=$! p=$!
trap 'kill -USR1 $p' USR1
trap 'kill $p' INT TERM trap 'kill $p' INT TERM
wait wait