From: Ralph Ronnquist Date: Mon, 21 Mar 2022 03:29:08 +0000 (+1100) Subject: added stop script X-Git-Tag: deb_0.1~25 X-Git-Url: https://git.rrq.au/?a=commitdiff_plain;h=94d01e2775fdeb67ab729b4e7b98867e6cd97c16;p=rrq%2Foverlay-boot.git added stop script --- diff --git a/overlay-stop b/overlay-stop new file mode 100755 index 0000000..2c57c52 --- /dev/null +++ b/overlay-stop @@ -0,0 +1,25 @@ +#!/bin/sh +# +# Script to stop the nominated overlay subhost + +[ $(id -u) = 0 ] || exec sudo $0 $@ +. $(dirname $(realpath $0))/functions XXX + +NAME="$1" + +read USPID RSPID <&2 && exit 1 + +if [ -z "$RSPID" ] ; then + cat <&2 +*** $NAME is started (pid $USPID) but doesn't seem to be running +*** /.reaper and might need manual fixing. +EOF + exit 1 +fi + +CHILDPIDS="$(nsenter -t $RSPID -p -m ps -hopid --ppid 1)" +nsenter -t $RSPID -p -m kill $CHILDPIDS