X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Ftestsuite%2Fstop-server.sh;h=c531137e2b10843f44db65f435085905b5bd38ab;hp=af28bae1b567d40ad2073f23824f6b6b8dced88b;hb=7d7eb735f0c8b541e7809a68cb49174605147904;hpb=508fa48aa6342beb50e510285b683abe54e0fe92 diff --git a/src/testsuite/stop-server.sh b/src/testsuite/stop-server.sh index af28bae1..c531137e 100755 --- a/src/testsuite/stop-server.sh +++ b/src/testsuite/stop-server.sh @@ -1,15 +1,37 @@ #!/bin/sh # ngIRCd Test Suite -# $Id: stop-server.sh,v 1.4 2002/09/16 09:53:16 alex Exp $ -echo " stopping server ..." +[ -z "$srcdir" ] && srcdir=`dirname $0` -PS_FLAGS=a; PS_PIDCOL=1 -ps a > /dev/null 2>&1 -if [ $? -ne 0 ]; then PS_FLAGS=-f; PS_PIDCOL=2; fi +# read in functions +. ${srcdir}/functions.inc -ps $PS_FLAGS > procs.tmp -pid=`cat procs.tmp | grep ngircd-TEST | awk "{ print \\\$$PS_PIDCOL }"` -kill $pid > /dev/null 2>&1 +if [ -n "$1" ]; then + id="$1"; shift +else + id="1" +fi + +echo_n "stopping server ${id} ..." + +# stop test-server ... +pid=`./getpid.sh T-ngircd${id}` +if [ -z "$pid" ]; then + echo " failure: no running server found!?" + exit 1 +fi +kill $pid > /dev/null 2>&1 || exit 1 + +# waiting ... +for i in 1 2 3 4 5; do + kill -0 $pid > /dev/null 2>&1; r=$? + if [ $r -ne 0 ]; then + echo " ok". + exit 0 + fi + sleep 1 +done +echo " failure: server ${id} still running!?" +exit 1 # -eof-