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=0064baf2bf3662b0903f8356452347d327f009c4;hb=7d7eb735f0c8b541e7809a68cb49174605147904;hpb=90ab7c7c48da57bcd7890b5809e99aa4b685c72a diff --git a/src/testsuite/stop-server.sh b/src/testsuite/stop-server.sh index 0064baf2..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.6 2002/09/20 13:57:01 alex Exp $ -echo " stopping server ..." +[ -z "$srcdir" ] && srcdir=`dirname $0` -PS_FLAGS=-f; PS_PIDCOL=2 -ps $PS_FLAGS > /dev/null 2>&1 -if [ $? -ne 0 ]; then PS_FLAGS=a; PS_PIDCOL=1; fi +# read in functions +. ${srcdir}/functions.inc -ps $PS_FLAGS > procs.tmp -pid=`cat procs.tmp | grep ngircd-TEST | awk "{ print \\\$$PS_PIDCOL }"` -[ -n "$pid" ] && kill -0 $pid > /dev/null 2>&1 || exit 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-