ngircd.init 1.7 KB

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