blob: 0d82fec816e0e2f8589eea4c4ee9dd065fea09bb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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
|