|
| 1 | +#!/bin/sh |
| 2 | +# OpenNAP crontab checking file, used to restart your OpenNAP server |
| 3 | +# if for some reason it crashed, or the host system reboots. |
| 4 | +# |
| 5 | +# To check to see if your OpenNAP server is running do one of the |
| 6 | +# following (10 minute intervals): |
| 7 | +# |
| 8 | +# 0,10,20,30,40,50 * * * * /home/mydir/napchk |
| 9 | +# |
| 10 | +# If you do not wish to recieve email when your OpenNAP server was |
| 11 | +# restarted, do the following: |
| 12 | +# |
| 13 | +# 0,10,20,30,40,50 * * * * /home/mydir/napchk >/dev/null 2>&1 |
| 14 | +# |
| 15 | + |
| 16 | + |
| 17 | +# Set this to the home opennap path |
| 18 | +OPENNAPPATH=/home/wolf/opennap |
| 19 | + |
| 20 | +# Set this to the opennap shared folder path |
| 21 | +OPENNAPSHAREPATH=$OPENNAPPATH/share/opennap |
| 22 | + |
| 23 | +# Set this to the path where opennap binary is located |
| 24 | +OPENNAPBINPATH=$OPENNAPPATH/bin |
| 25 | + |
| 26 | +# The rest should not need to be changed. |
| 27 | + |
| 28 | +cd $OPENNAPSHAREPATH |
| 29 | +if test -r pid; then |
| 30 | + OPENNAPPID=$(cat pid) |
| 31 | + if $(kill -CHLD $OPENNAPPID >/dev/null 2>&1); then |
| 32 | + # OpenNAP is still running, Exit |
| 33 | + exit 0 |
| 34 | + fi |
| 35 | + echo "" |
| 36 | + echo "Found an old pid file, Removing..." |
| 37 | + rm -f pid |
| 38 | +fi |
| 39 | +echo "" |
| 40 | +echo "OpenNAP is not running, Restarting..." |
| 41 | +echo "" |
| 42 | + |
| 43 | +cd $OPENNAPBINPATH |
| 44 | +if test -r opennap ;then |
| 45 | + ./opennap -b |
| 46 | + exit 0 |
| 47 | +fi |
| 48 | +echo "Could not reload OpenNAP" |
| 49 | +exit 0 |
0 commit comments