Blame


1 c4d78a34 2002-09-09 alex #!/bin/sh
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 $
4 c4d78a34 2002-09-09 alex
5 9d928b24 2002-09-23 alex [ -z "$srcdir" ] && srcdir=`dirname $0`
6 9d928b24 2002-09-23 alex
7 450251f0 2004-09-06 alex # read in functions
8 450251f0 2004-09-06 alex . ${srcdir}/functions.inc
9 c4d78a34 2002-09-09 alex
10 450251f0 2004-09-06 alex echo_n " starting server ..."
11 450251f0 2004-09-06 alex
12 1ed708ef 2003-08-22 alex # remove old logfiles
13 efedfe12 2002-09-20 alex rm -rf logs *.log
14 05bf66df 2002-09-12 alex
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!"
20 efedfe12 2002-09-20 alex exit 1
21 efedfe12 2002-09-20 alex fi
22 efedfe12 2002-09-20 alex
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!"
27 1ed708ef 2003-08-22 alex exit 1
28 1ed708ef 2003-08-22 alex fi
29 1ed708ef 2003-08-22 alex
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
32 c4d78a34 2002-09-09 alex
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 &
35 c4d78a34 2002-09-09 alex sleep 1
36 c4d78a34 2002-09-09 alex
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=$?
40 c4d78a34 2002-09-09 alex
41 c5bdd86f 2004-09-04 alex [ $r -eq 0 ] && echo " ok." || echo " failure!"
42 c5bdd86f 2004-09-04 alex exit
43 c5bdd86f 2004-09-04 alex
44 c4d78a34 2002-09-09 alex # -eof-