stop-server.sh 590 B

12345678910111213141516171819202122232425262728293031323334353637
  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 "stopping server ${id} ..."
  12. # stop test-server ...
  13. pid=`./getpid.sh T-ngircd${id}`
  14. if [ -z "$pid" ]; then
  15. echo " failure: no running server found!?"
  16. exit 1
  17. fi
  18. kill $pid > /dev/null 2>&1 || exit 1
  19. # waiting ...
  20. for i in 1 2 3 4 5; do
  21. kill -0 $pid > /dev/null 2>&1; r=$?
  22. if [ $r -ne 0 ]; then
  23. echo " ok".
  24. exit 0
  25. fi
  26. sleep 1
  27. done
  28. echo " failure: server ${id} still running!?"
  29. exit 1
  30. # -eof-