Prepare for srcdir != builddir in tests
[idzebra-moved-to-github.git] / test / gils / stop01.sh
1 #!/bin/sh
2 # $Id: stop01.sh,v 1.6 2004-06-14 23:45:11 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
24 echo "  checking that it runs... " >>$LOG
25 test -f zebrasrv.pid || exit 1
26 PID=`cat zebrasrv.pid`
27 ps -p $PID |grep $PID >/dev/null || exit 1
28
29 echo "  connecting to it..." >>$LOG
30 ../api/testclient localhost:9901 utah >>$LOG || exit 1
31 sleep 1
32
33 echo "  checking that server does not run any more" >>$LOG
34 ps -p $PID | grep $PID >/dev/null && exit 1
35
36 # clean up
37 rm -rf reg zebrasrv.pid