Add zebrasrv.pid
[idzebra-moved-to-github.git] / util / zebrasrv.rh
1 #!/bin/bash
2 #
3 # chkconfig: 2345 85 15
4 # description: Redhat init.d zebrasrv script.
5 # processname: zebrasrv
6
7 # source function library
8 . /etc/rc.d/init.d/functions
9
10 zebradir=/home/meta/silkeborg/db
11 srv=/home/meta/silkeborg/zmbol/index/zmbolsrv
12 user=nobody
13         
14 if [ ! -d ${zebradir} ]; then
15         echo "No directory $zebradir"
16         exit 0
17 fi
18
19 if [ ! -f ${srv} ]; then
20         echo "No server $srv"
21         exit 0
22 fi
23
24 cd $zebradir
25
26 case "$1" in
27   start)
28         echo -n "Starting zebrasrv "
29
30         ${srv} -l srv.log -u $user tcp:@:210 &
31
32         echo
33         ;;
34   stop)
35         echo -n "Shutting zebrasrv "
36
37         kill `cat $zebradir/zebrasrv.pid`
38
39         echo ""
40         ;;
41   restart|reload)
42         $0 stop
43         $0 start
44         ;;
45   *)
46         echo "Usage: zebrasrv {start|stop|restart|reload}"
47         exit 1
48 esac
49
50 exit 0
51