Blame


1 c4d78a34 2002-09-09 alex #!/bin/sh
2 c4d78a34 2002-09-09 alex # ngIRCd Test Suite
3 1ed708ef 2003-08-22 alex # $Id: start-server.sh,v 1.11 2003/08/22 11:31:18 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 c4d78a34 2002-09-09 alex echo " starting server ..."
8 c4d78a34 2002-09-09 alex
9 1ed708ef 2003-08-22 alex # remove old logfiles
10 efedfe12 2002-09-20 alex rm -rf logs *.log
11 05bf66df 2002-09-12 alex
12 1ed708ef 2003-08-22 alex # check weather getpid.sh returns valid PIDs. If not, don't start up the
13 1ed708ef 2003-08-22 alex # test-server, because we won't be able to kill it at the end of the test.
14 797f9170 2002-11-10 alex ./getpid.sh sh > /dev/null 2>&1
15 efedfe12 2002-09-20 alex if [ $? -ne 0 ]; then
16 efedfe12 2002-09-20 alex echo " error: getpid.sh FAILED!"
17 efedfe12 2002-09-20 alex exit 1
18 efedfe12 2002-09-20 alex fi
19 efedfe12 2002-09-20 alex
20 1ed708ef 2003-08-22 alex # check if there is a test-server already running
21 1ed708ef 2003-08-22 alex ./getpid.sh T-ngircd > /dev/null 2>&1
22 1ed708ef 2003-08-22 alex if [ $? -eq 0 ]; then
23 1ed708ef 2003-08-22 alex echo " error: test-server already running!"
24 1ed708ef 2003-08-22 alex exit 1
25 1ed708ef 2003-08-22 alex fi
26 1ed708ef 2003-08-22 alex
27 1ed708ef 2003-08-22 alex # generate MOTD for test-server
28 c4d78a34 2002-09-09 alex echo "This is an ngIRCd Test Server" > ngircd-test.motd
29 c4d78a34 2002-09-09 alex
30 1ed708ef 2003-08-22 alex # starting up test-server ...
31 797f9170 2002-11-10 alex ./T-ngircd -np -f ${srcdir}/ngircd-test.conf > ngircd-test.log 2>&1 &
32 c4d78a34 2002-09-09 alex sleep 1
33 c4d78a34 2002-09-09 alex
34 1ed708ef 2003-08-22 alex # validate running test-server
35 797f9170 2002-11-10 alex pid=`./getpid.sh T-ngircd`
36 90ab7c7c 2002-09-20 alex [ -n "$pid" ] && kill -0 $pid > /dev/null 2>&1 || exit 1
37 c4d78a34 2002-09-09 alex
38 c4d78a34 2002-09-09 alex # -eof-