From 2278df1493e064c197913e49b5d1935942d83448 Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 6 May 2025 16:57:32 -0700 Subject: initial import --- noawareness-pid-check.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 noawareness-pid-check.sh (limited to 'noawareness-pid-check.sh') diff --git a/noawareness-pid-check.sh b/noawareness-pid-check.sh new file mode 100644 index 0000000..0d82fec --- /dev/null +++ b/noawareness-pid-check.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +# noawareness-pid-check.sh -- by Daniel Roberson +# -- simple script to respawn noawareness if it dies. +# -- meant to be placed in your crontab! +# -- +# -- * * * * * /path/to/noawareness-pid-check.sh + +# Season to taste: +PIDFILE="/var/run/noawareness.pid" +BINPATH="/root/noawareness/noawareness -d -p $PIDFILE" + +if [ ! -f $PIDFILE ]; then + # PIDFILE doesnt exist! + echo "noawareness not running. Attempting to start.." + $BINPATH + exit +else + # PID file exists. check if its running! + kill -0 "$(head -n 1 $PIDFILE)" 2>/dev/null + if [ $? -eq 0 ]; then + exit 0 + else + echo "noawareness not running. Attempting to start.." + $BINPATH + fi +fi + -- cgit v1.2.3