Makefile updates for Automake 1.5+. Test script updates
[idzebra-moved-to-github.git] / test / gils / stop01.sh
1 #!/bin/sh
2 # $Id: stop01.sh,v 1.4 2003-05-21 14:39:22 adam Exp $
3 # test start and stop of the server with -1
4
5 echo "initializing"
6 mkdir -p reg
7 rm -f idx.log srv.log
8 ../../index/zebraidx -l idx.log -c zebra1.cfg init || exit 1
9
10 #create a base to test on
11 ../../index/zebraidx -l idx.log -c zebra1.cfg update records  || exit 1
12
13 #kill old server (if any)
14 test -f zebrasrv.pid && kill -9 `cat zebrasrv.pid`
15 rm -f zebrasrv.pid
16 rm -f srv.log
17
18 echo "Starting server with -1 (one shot)..."
19 ../../index/zebrasrv -1 -c zebra1.cfg -l srv.log tcp:@:9901 &
20 sleep 1
21
22 echo "  checking that it runs... "
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..."
28 ../api/testclient localhost:9901 utah > log || exit 1
29 sleep 1
30
31 echo "  checking that server does not run any more"
32 ps -p $PID | grep $PID >/dev/null && exit 1
33
34 # clean up
35 rm -rf reg idx.log srv.log zebrasrv.pid