2 # $Id: stop03.sh,v 1.6 2003-09-24 11:45:44 adam Exp $
3 # test start and stop of the threaded server (-T)
8 echo "initializing" >>$LOG
10 ../../index/zebraidx -l $LOG -c zebra1.cfg init || exit 1
12 #create a base to test on
13 ../../index/zebraidx -l $LOG -c zebra1.cfg update records || exit 1
15 #kill old server (if any)
16 test -f zebrasrv.pid && kill -9 `cat zebrasrv.pid`
18 echo "Starting server with -T (threaded)..." >>$LOG
20 ../../index/zebrasrv -T -c zebra1.cfg -l $LOG tcp:@:9901 2>out ||
21 echo "server failed with $?" > $LOG
25 if grep 'not available' out >/dev/null; then
26 test -f zebrasrv.pid && rm zebrasrv.pid
29 echo " checking that it runs... " >>$LOG
30 test -f zebrasrv.pid || exit 1
31 PID=`cat zebrasrv.pid`
32 ps -p $PID | grep $PID >/dev/null || exit 1
34 echo " connecting to it..." >>$LOG
35 ../api/testclient localhost:9901 utah >>$LOG || exit 1
38 echo " checking that it still runs..." >>$LOG
39 ps -p $PID >/dev/null || exit 1
41 echo " connecting again, with a delay..." >>$LOG
42 ../api/testclient localhost:9901 utah 5 >>$LOG &
43 sleep 1 # let the client connect
45 echo " killing it..." >>$LOG
49 echo " checking that it is dead" >>$LOG
50 ps -p $PID | grep $PID >/dev/null && exit 1
53 rm -rf reg zebrasrv.pid