c91e76afb9054dc3fb1371edce0be1797bf5819c
[idzebra-moved-to-github.git] / test / gils / stop01.sh
1 #!/bin/sh
2 # $Id: stop01.sh,v 1.7 2004-09-24 15:03:19 adam Exp $
3 # test start and stop of the server with -1
4
5 pp=${srcdir:-"."}
6
7 LOG=stop01.log
8
9 rm -f $LOG
10 echo "initializing" >>$LOG
11 mkdir -p reg
12 ../../index/zebraidx -l $LOG -c $pp/zebra1.cfg init || exit 1
13
14 #create a base to test on
15 ../../index/zebraidx -l $LOG -c $pp/zebra1.cfg update records  || exit 1
16
17 #kill old server (if any)
18 test -f zebrasrv.pid && kill -9 `cat zebrasrv.pid`
19
20 echo "Starting server with -1 (one shot)..." >>$LOG
21 ../../index/zebrasrv -1 -c $pp/zebra1.cfg -l $LOG tcp:@:9901 &
22 sleep 1
23 echo "  checking that it runs... " >>$LOG
24 test -f zebrasrv.pid || sleep 5 || test -f zebrasrv.pid || exit 1
25 PID=`cat zebrasrv.pid`
26 ps -p $PID |grep $PID >/dev/null || exit 1
27
28 echo "  connecting to it..." >>$LOG
29 ../api/testclient localhost:9901 utah >>$LOG || exit 1
30 sleep 1
31
32 echo "  checking that server does not run any more" >>$LOG
33 ps -p $PID | grep $PID >/dev/null && exit 1
34
35 # clean up
36 rm -rf reg zebrasrv.pid