tests writes to log file instead of stdout
[idzebra-moved-to-github.git] / test / gils / stop02.sh
1 #!/bin/sh
2 # $Id: stop02.sh,v 1.5 2003-05-24 22:34:48 adam Exp $
3 # test start and stop of the server with -S
4
5 LOG=stop02.log
6
7 rm -f $LOG
8 echo "initializing" >>$LOG
9 mkdir -p reg
10 ../../index/zebraidx -l $LOG -c zebra1.cfg init || exit 1
11
12 #create a base to test on
13 ../../index/zebraidx -l $LOG -c zebra1.cfg update records  || exit 1
14
15 #kill old server (if any)
16 test -f zebrasrv.pid && kill -9 `cat zebrasrv.pid`
17
18 echo "Starting server with -S (static)..." >>$LOG
19 ../../index/zebrasrv -S -c zebra1.cfg -l $LOG tcp:@:9901 &
20 sleep 1
21
22 echo "  checking that it runs... " >>$LOG
23 test -f zebrasrv.pid || exit 1
24 PID=`cat zebrasrv.pid`
25 ps -p $PID |grep $PID >/dev/null || exit 1
26
27 echo "  connecting to it..." >>$LOG
28 ../api/testclient localhost:9901 utah >>$LOG || exit 1
29 sleep 1
30
31 echo "  checking that it still runs..." >>$LOG
32 ps -p $PID | grep $PID >/dev/null || exit 1
33
34 echo "  connecting again, with a delay..." >>$LOG
35 ../api/testclient -d 5 localhost:9901 utah >>$LOG &
36 sleep 1 # let the client connect 
37
38 echo "  killing it..." >>$LOG
39 kill $PID
40
41 sleep 1
42 echo "  checking that it is dead..." >>$LOG
43 ps -p $PID | grep $PID >/dev/null && exit 1
44
45 # clean up
46 rm -rf reg zebrasrv.pid