/
napchk
49 lines (43 loc) · 1.23 KB
/
napchk
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
# OpenNAP crontab checking file, used to restart your OpenNAP server
# if for some reason it crashed, or the host system reboots.
#
# To check to see if your OpenNAP server is running do one of the
# following (10 minute intervals):
#
# 0,10,20,30,40,50 * * * * /home/mydir/napchk
#
# If you do not wish to recieve email when your OpenNAP server was
# restarted, do the following:
#
# 0,10,20,30,40,50 * * * * /home/mydir/napchk >/dev/null 2>&1
#
# -- WoLf (itzwolf@usa.net)
# Set this to the home opennap path
OPENNAPPATH=/home/wolf/opennap
# Set this to the opennap shared folder path
OPENNAPSHAREPATH=$OPENNAPPATH/share/opennap
# Set this to the path where opennap binary is located
OPENNAPBINPATH=$OPENNAPPATH/bin
# The rest should not need to be changed.
cd $OPENNAPSHAREPATH
if test -r pid; then
OPENNAPPID=$(cat pid)
if $(kill -CHLD $OPENNAPPID >/dev/null 2>&1); then
# OpenNAP is still running, Exit
exit 0
fi
echo ""
echo "Found an old pid file, Removing..."
rm -f pid
fi
echo ""
echo "OpenNAP is not running, Restarting..."
echo ""
cd $OPENNAPBINPATH
if test -r opennap ;then
./opennap -b
exit 0
fi
echo "Could not reload OpenNAP"
exit 0