Move Zebra for port 3313 to 8018 (which is visible on test through its firewall)
[irspy-moved-to-github.git] / zebra / init-script
1 #! /bin/sh
2
3 # $Id: init-script,v 1.2 2006-12-13 12:02:59 mike Exp $
4 #
5 # This is a startup/shutdown script for IRSpy's Zebra server, suitable
6 # for use in a SysV-style init directory such as /etc/init.d (on
7 # Debian systems) and /etc/rc.d/init.d (on Red Hat systems), like this:
8 #
9 #       cd /etc/init.d
10 #       sudo ln -s /usr/local/src/cvs/irspy/zebra/init-script irspy-zebra
11 #       sudo /etc/init.d/irspy-zebra start
12 #
13 # You may need to tweak it to suit your system's paths.
14
15
16 # zebrasrv-2.0 may be in /usr/local/bin, hence this slight security hole
17 PATH=/bin:/usr/bin:/usr/local/bin/
18 logfile=/var/log/irspy-zebra
19 pidfile=/var/run/irspy-zebra.pid
20
21 case "$1" in
22   start)
23         if [ -f $pidfile ]; then
24                 echo "IRSpy's Zebra seems to be already running"
25                 exit 1
26         fi
27         echo "Starting IRSpy's Zebra"
28         test -f $logfile && mv $logfile $logfile.old
29         ( cd /usr/local/src/cvs/irspy/zebra
30           zebrasrv-2.0 -f yazserver.xml < /dev/null > $logfile 2>&1 &
31           echo $! > $pidfile
32         )
33         ;;
34   stop)
35         if [ ! -f $pidfile ]; then
36                 echo "IRSpy's Zebra does not seem to be running"
37                 exit 1
38         fi
39         echo "Stopping IRSpy's Zebra"
40         kill `cat $pidfile`
41         rm $pidfile
42         ;;
43   restart)
44         $0 stop && $0 start
45         ;;
46   *)
47         echo "Usage: $0 start|stop|restart" >&2
48         ;;
49 esac