3 # ngIRCd start and stop script for Debian-based systems
4 # Copyright 2008 Alexander Barton <alex@barton.de>
9 # Required-Start: $remote_fs
10 # Required-Stop: $remote_fs
11 # Should-Start: $syslog
12 # Should-Stop: $syslog
13 # Default-Start: 2 3 4 5
15 # Short-Description: Next Generation IRC Server
18 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
19 DAEMON=/usr/sbin/ngircd
24 test -h "$0" && me=`readlink $0` || me="$0"
25 BASENAME=`basename $me`
27 test -r /etc/default/$BASENAME && . /etc/default/$BASENAME
29 test -x $DAEMON || exit 0
31 # LSB compatibility functions that become used if there is no local
32 # include file available.
37 [ "$1" == "0" ] && echo "." || echo " failed!"
43 # Include LSB functions, if available:
44 test -r /lib/lsb/init-functions && . /lib/lsb/init-functions
48 # Make sure that the configuration of ngIRCd is valid:
49 $DAEMON --configtest >/dev/null 2>&1
51 log_failure_msg "Configuration of $NAME is not valid, won't (re)start!"
52 log_failure_msg "Run \"$DAEMON --configtest\" and fix it up ..."
55 # Make sure the PID file directory exists and is writable:
56 if [ ! -d /var/run/ircd ]; then
57 mkdir -p /var/run/ircd
59 chown irc:irc /var/run/ircd
65 log_daemon_msg "Starting $DESC" "$NAME"
66 start-stop-daemon --start \
67 --quiet --exec $DAEMON -- $PARAMS
71 log_daemon_msg "Stopping $DESC" "$NAME"
72 [ -r /var/run/ircd/ngircd.pid ] \
73 && PIDFILE="--pidfile /var/run/ircd/ngircd.pid" \
75 start-stop-daemon --stop \
76 --quiet --oknodo --exec $DAEMON $PIDFILE
81 log_daemon_msg "Reloading $DESC" "$NAME"
82 start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON
87 log_daemon_msg "Restarting $DESC" "$NAME"
88 [ -r /var/run/ircd/ngircd.pid ] \
89 && PIDFILE="--pidfile /var/run/ircd/ngircd.pid" \
91 start-stop-daemon --stop \
92 --quiet --oknodo --exec $DAEMON $PIDFILE
94 start-stop-daemon --start \
95 --quiet --exec $DAEMON -- $PARAMS
100 echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2