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.5
Committed: Fri Mar 28 16:30:30 2003 UTC (21 years, 7 months ago) by tdb
Content type: application/x-sh
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +1 -1 lines
State: FILE REMOVED
Log Message:
Removed some un-used code from CVS. We can always resurrect this later if
someone feels they want to work on it. Gone are the old perl ihost which
isn't needed now, winhost which is broken and shows no sign of being fixed,
and DBReporter. If someone wants to revive them, I'll undelete them :-)

File Contents

# User Rev Content
1 tdb 1.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 tdb 1.5 # $Id: ihostchk.sh,v 1.4 2001/11/21 10:08:20 tdb Exp $
13 tdb 1.1 #
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 tdb 1.2 # CHANGE this to point to the PID file
23 tdb 1.4 #piddir=${HOME:-/var/tmp}
24     piddir="/var/tmp"
25 tdb 1.3 pidfile="$piddir/.ihost.pid"
26 tdb 1.1
27     ###### You probably don't need to change anything below here ######
28    
29     ihost="ihost.pl"
30    
31     cd $ihostdir
32    
33     # is there a pid file?
34     if test -r $pidfile
35     then
36     # there is a pid file, check to see if it's current
37     ihostpid=`cat $pidfile`
38     if `kill -CHLD $ihostpid >/dev/null 2>&1`
39     then
40     # it's still alive, lets leave it be
41     exit 0
42     fi
43     # old pid file found
44     echo ""
45     echo "Stale $pidfile file, removing..."
46     rm -f $pidfile
47     fi
48    
49     # if we got here, we're clear to restart ihost
50     echo ""
51     echo "ihost is not running, starting up..."
52     echo ""
53     ./$ihost $fmhost $fmport &
54     exit 0
55    
56     # finished