2 c4d78a34 2002-09-09 alex # ngIRCd Test Suite
3 450251f0 2004-09-06 alex # $Id: start-server.sh,v 1.14 2004/09/06 22:04:06 alex Exp $
5 9d928b24 2002-09-23 alex [ -z "$srcdir" ] && srcdir=`dirname $0`
7 450251f0 2004-09-06 alex # read in functions
8 450251f0 2004-09-06 alex . ${srcdir}/functions.inc
10 450251f0 2004-09-06 alex echo_n " starting server ..."
12 1ed708ef 2003-08-22 alex # remove old logfiles
13 efedfe12 2002-09-20 alex rm -rf logs *.log
15 1ed708ef 2003-08-22 alex # check weather getpid.sh returns valid PIDs. If not, don't start up the
16 1ed708ef 2003-08-22 alex # test-server, because we won't be able to kill it at the end of the test.
17 797f9170 2002-11-10 alex ./getpid.sh sh > /dev/null 2>&1
18 efedfe12 2002-09-20 alex if [ $? -ne 0 ]; then
19 c5bdd86f 2004-09-04 alex echo " getpid.sh failed!"
23 1ed708ef 2003-08-22 alex # check if there is a test-server already running
24 1ed708ef 2003-08-22 alex ./getpid.sh T-ngircd > /dev/null 2>&1
25 1ed708ef 2003-08-22 alex if [ $? -eq 0 ]; then
26 c5bdd86f 2004-09-04 alex echo " failure: test-server already running!"
30 1ed708ef 2003-08-22 alex # generate MOTD for test-server
31 c4d78a34 2002-09-09 alex echo "This is an ngIRCd Test Server" > ngircd-test.motd
33 1ed708ef 2003-08-22 alex # starting up test-server ...
34 02b8e515 2004-09-04 alex ./T-ngircd -np -f ${srcdir}/ngircd-test.conf $* > ngircd-test.log 2>&1 &
37 1ed708ef 2003-08-22 alex # validate running test-server
38 797f9170 2002-11-10 alex pid=`./getpid.sh T-ngircd`
39 c5bdd86f 2004-09-04 alex [ -n "$pid" ] && kill -0 $pid > /dev/null 2>&1; r=$?
41 c5bdd86f 2004-09-04 alex [ $r -eq 0 ] && echo " ok." || echo " failure!"