darling/tools/shutdown-user.sh

16 lines
360 B
Bash
Raw Normal View History

echo "Seeing if Darling is currently running"
PID=`pgrep launchd`
while [[ ! -z $PID ]]
do
THISPID=$(echo $PID | head -n1)
2019-11-26 04:54:37 +00:00
RUNNING_USER=$(ps -o uname= -p $THISPID | head -n1)
echo "Darling currently running for $RUNNING_USER, shutting it down..."
sudo -u $RUNNING_USER darling shutdown
sleep 2
PID=`pgrep launchd`
done
echo "No instances running now"