ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/ihost-perl/ihostchk.sh
Revision: 1.2
Committed: Mon Mar 12 23:51:15 2001 UTC (23 years, 6 months ago) by tdb
Content type: application/x-sh
Branch: MAIN
CVS Tags: PROJECT_COMPLETION
Changes since 1.1: +3 -2 lines
Log Message:
Changed the path of the PID file... it didn't work so well when the ihost
directory is on a shared file store :)

File Contents

# Content
1 #!/bin/sh
2 #
3 # Script to check that ihost is still running, and restart if necessary.
4 #
5 # You probably want to add this to a cronjob, say every 10 minutes:
6 # 0,10,20,30,40,50 * * * * /path/to/ihostchk.sh
7 # And if you find yourself getting e-mails, use the following instead:
8 # 0,10,20,30,40,50 * * * * /path/to/ihostchk.sh >/dev/null 2>&1
9 # NOTE: e-mails should only be sent if an error occurs, so the former is
10 # the best choice for a cronjob.
11 #
12 # $Id: ihostchk.sh,v 1.1 2001/03/12 23:23:04 tdb1 Exp $
13 #
14
15 # CHANGE this to the directory of the ihost.pl script
16 ihostdir="/home/cut/tdb1/cvs/source/host/ihost"
17
18 # CHANGE these to represent your filtermanager details
19 fmhost="raptor.ukc.ac.uk"
20 fmport="4567"
21
22 # CHANGE this to point to the PID file
23 pidfile="/var/tmp/ihost.pid"
24
25 ###### You probably don't need to change anything below here ######
26
27 ihost="ihost.pl"
28
29 cd $ihostdir
30
31 # is there a pid file?
32 if test -r $pidfile
33 then
34 # there is a pid file, check to see if it's current
35 ihostpid=`cat $pidfile`
36 if `kill -CHLD $ihostpid >/dev/null 2>&1`
37 then
38 # it's still alive, lets leave it be
39 exit 0
40 fi
41 # old pid file found
42 echo ""
43 echo "Stale $pidfile file, removing..."
44 rm -f $pidfile
45 fi
46
47 # if we got here, we're clear to restart ihost
48 echo ""
49 echo "ihost is not running, starting up..."
50 echo ""
51 ./$ihost $fmhost $fmport &
52 exit 0
53
54 # finished