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