1
0

ngircd.init 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/bin/sh
  2. #
  3. # ngIRCd start and stop script for Debian-based systems
  4. #
  5. # $Id: ngircd.init,v 1.5.2.1 2005/07/26 19:30:54 alex Exp $
  6. #
  7. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  8. DAEMON=/usr/sbin/ngircd
  9. NAME=ngIRCd
  10. DESC="IRC daemon"
  11. PARAMS=""
  12. test -h "$0" && me=`readlink $0` || me="$0"
  13. BASENAME=`basename $me`
  14. test -f /etc/default/$BASENAME && . /etc/default/$BASENAME
  15. test -x $DAEMON || exit 0
  16. Check_Config()
  17. {
  18. $DAEMON --configtest >/dev/null 2>&1
  19. if [ $? -ne 0 ]; then
  20. echo "Configuration of $NAME is not valide, won't (re)start!"
  21. echo "Please run \"$DAEMON --configtest\" manually and fix it up ..."
  22. exit 1
  23. fi
  24. }
  25. Try_Start()
  26. {
  27. [ ! -d /var/run/ircd ] || chown irc:irc /var/run/ircd
  28. start-stop-daemon --start --quiet --exec $DAEMON -- $PARAMS
  29. if [ $? -ne 0 ]; then
  30. echo "$NAME failed!"
  31. exit 1
  32. fi
  33. echo "$NAME."
  34. }
  35. case "$1" in
  36. start)
  37. Check_Config
  38. echo -n "Starting $DESC: "
  39. Try_Start
  40. ;;
  41. stop)
  42. echo -n "Stopping $DESC: "
  43. start-stop-daemon --stop --quiet --pidfile /var/run/ircd/ngircd.pid --exec $DAEMON \
  44. && echo "$NAME." \
  45. || echo "(none running)"
  46. ;;
  47. reload|force-reload)
  48. Check_Config
  49. echo "Reloading $DESC configuration files."
  50. start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON
  51. ;;
  52. restart)
  53. Check_Config
  54. echo -n "Restarting $DESC: "
  55. start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
  56. sleep 1
  57. Try_Start
  58. ;;
  59. *)
  60. N=/etc/init.d/$NAME
  61. echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
  62. exit 1
  63. ;;
  64. esac
  65. exit 0
  66. # -eof-