83f23136ff41044e0cdf88a80534534f1d3c251a
[ZOOM-Perl-moved-to-github.git] / archive / test-server / test-server.init
1 #! /bin/sh
2
3 # $Id: test-server.init,v 1.6 2008-09-29 15:50:01 mike Exp $
4 #
5 # This is a startup/shutdown script for the ZOOM-Perl test-server,
6 # suitable for use in a SysV-style init directory such as /etc/init.d
7 # (on Debian systems) and /etc/rc.d/init.d (on Red Hat systems).  This
8 # is configured to run on z3950.indexdata.com -- if you want to run it
9 # somewhere else, you'll probably need to tweak it to suit your
10 # system's paths.
11
12 PATH=/bin:/usr/bin
13 logfile=/var/log/zoom-perl-test-server
14 pidfile=/var/run/zoom-perl-test-server.pid
15
16 case "$1" in
17   start)
18         if [ -f $pidfile ]; then
19                 echo "ZOOM-Perl test server seems to be already running"
20                 exit 1
21         fi
22         echo "Starting ZOOM-Perl test server"
23         test -f $logfile && mv $logfile $logfile.old
24         ( cd /home/mike/ZOOM-Perl/archive/test-server
25           zebrasrv-2.0 -c test-server.cfg @:2100 > $logfile 2>&1 < /dev/null &
26           echo $! > $pidfile
27         )
28         ;;
29   stop)
30         if [ ! -f $pidfile ]; then
31                 echo "ZOOM-Perl test server does not seem to be running"
32                 exit 1
33         fi
34         echo "Stopping ZOOM-Perl test server"
35         kill `cat $pidfile`
36         rm $pidfile
37         ;;
38   restart)
39         $0 stop && $0 start
40         ;;
41   *)
42         echo "Usage: $0 start|stop|restart" >&2
43         ;;
44 esac