start-server.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/sh
  2. # ngIRCd Test Suite
  3. [ -z "$srcdir" ] && srcdir=`dirname $0`
  4. # read in functions
  5. . ${srcdir}/functions.inc
  6. if [ -n "$1" ]; then
  7. id="$1"; shift
  8. else
  9. id="1"
  10. fi
  11. echo_n "starting server ${id} ..."
  12. # remove old logfiles, if this is the first server (ID 1)
  13. [ "$id" = "1" ] && rm -rf logs *.log
  14. # check weather getpid.sh returns valid PIDs. If not, don't start up the
  15. # test-server, because we won't be able to kill it at the end of the test.
  16. ./getpid.sh sh > /dev/null 2>&1
  17. if [ $? -ne 0 ]; then
  18. echo " getpid.sh failed!"
  19. exit 1
  20. fi
  21. # check if there is a test-server already running
  22. ./getpid.sh T-ngircd${id} >/dev/null 2>&1
  23. if [ $? -eq 0 ]; then
  24. echo " failure: test-server ${id} already running!"
  25. exit 1
  26. fi
  27. # generate MOTD for test-server
  28. echo "This is an ngIRCd Test Server" > ngircd-test${id}.motd
  29. # glibc memory checking, see malloc(3)
  30. MALLOC_CHECK_=3
  31. export MALLOC_CHECK_
  32. # starting up test-server ...
  33. ./T-ngircd${id} -n -f ${srcdir}/ngircd-test${id}.conf $* \
  34. >ngircd-test${id}.log 2>&1 &
  35. sleep 1
  36. # validate running test-server
  37. pid=`./getpid.sh T-ngircd${id}`
  38. [ -n "$pid" ] && kill -0 $pid > /dev/null 2>&1; r=$?
  39. [ $r -eq 0 ] && echo " ok." || echo " failure!"
  40. exit $r
  41. # -eof-