3 # $Id: idzebra-init-script,v 1.1 2007-01-31 12:26:50 mike Exp $
5 # This is a startup/shutdown script for Index Data's Zebra 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), like
10 # sudo cp idzebra-init-script /etc/init.d/idzebra
11 # sudo /etc/init.d/idzebra start
13 # You may need to tweak it to suit your system's paths.
15 # zebrasrv-2.0 may be in /usr/local/bin, hence this slight security hole
16 PATH=/bin:/usr/bin:/usr/local/bin/
17 catfile=/usr/local/src/cvs/zebra/etc/init.d/catalogue
22 line=`echo "$line" | sed 's/#.*//'`
23 line=`echo "$line" | sed 's/[ \t]*$//'`
24 if [ "x$line" != x ]; then
25 set $line; tag=$1; dir=$2; file=$3
26 #echo "tag='$tag', dir='$dir', file='$file'"
28 logfile=/var/log/zebra-$tag
29 pidfile=/var/run/zebra-$tag.pid
30 if [ -f $pidfile ]; then
31 echo "Zebra service '$tag' seems to be already running"
34 echo "Starting Zebra service '$tag'"
35 test -f $logfile && mv $logfile $logfile.old
39 *) echo "Unrecognised Zebra config-file type: '$file'";;
44 echo === $dir zebrasrv-2.0 $opt $file === < /dev/null > $logfile 2>&1
45 ( zebrasrv-2.0 $opt $file < /dev/null >> $logfile 2>&1 & )
53 # Unfortunate partial duplication of parsing code here
55 line=`echo "$line" | sed 's/#.*//'`
56 line=`echo "$line" | sed 's/[ \t]*$//'`
57 if [ "x$line" != x ]; then
60 pidfile=/var/run/zebra-$tag.pid
61 if [ ! -f $pidfile ]; then
62 echo "Zebra service '$tag' does not seem to be running"
66 echo "Stopping Zebra service '$tag'"
77 echo "Usage: $0 start|stop|restart" >&2