start-server.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. # starting up test-server ...
  30. ./T-ngircd${id} -n -f ${srcdir}/ngircd-test${id}.conf $* \
  31. >ngircd-test${id}.log 2>&1 &
  32. sleep 1
  33. # validate running test-server
  34. pid=`./getpid.sh T-ngircd${id}`
  35. [ -n "$pid" ] && kill -0 $pid > /dev/null 2>&1; r=$?
  36. [ $r -eq 0 ] && echo " ok." || echo " failure!"
  37. exit $r
  38. # -eof-