diff options
| author | daniel <daniel@planethacker.net> | 2025-05-06 16:57:32 -0700 |
|---|---|---|
| committer | daniel <daniel@planethacker.net> | 2025-05-06 16:57:32 -0700 |
| commit | 2278df1493e064c197913e49b5d1935942d83448 (patch) | |
| tree | 42f06ab2f76e2ddf228bafbb03f79621975a4534 /noawareness-pid-check.sh | |
initial import
Diffstat (limited to 'noawareness-pid-check.sh')
| -rw-r--r-- | noawareness-pid-check.sh | 28 |
1 files changed, 28 insertions, 0 deletions
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 + |
