2003-07-09 20:23:35 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# ngIRCd start and stop script for Debian-based systems
|
|
|
|
#
|
|
|
|
|
2006-12-26 14:43:46 +00:00
|
|
|
### BEGIN INIT INFO
|
|
|
|
# Provides: ircd
|
2008-05-27 23:50:18 +00:00
|
|
|
# Required-Start: $remote_fs
|
|
|
|
# Required-Stop: $remote_fs
|
|
|
|
# Should-Start: $syslog
|
|
|
|
# Should-Stop: $syslog
|
2006-12-26 14:43:46 +00:00
|
|
|
# Default-Start: 2 3 4 5
|
|
|
|
# Default-Stop: 0 1 6
|
|
|
|
# Short-Description: Next Generation IRC Server
|
|
|
|
### END INIT INFO
|
|
|
|
|
2003-07-09 20:23:35 +00:00
|
|
|
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
|
|
|
DAEMON=/usr/sbin/ngircd
|
|
|
|
NAME=ngIRCd
|
|
|
|
DESC="IRC daemon"
|
|
|
|
PARAMS=""
|
|
|
|
|
2005-07-26 19:37:18 +00:00
|
|
|
test -h "$0" && me=`readlink $0` || me="$0"
|
|
|
|
BASENAME=`basename $me`
|
2005-06-01 21:51:11 +00:00
|
|
|
|
2008-05-27 23:50:18 +00:00
|
|
|
test -r /etc/default/$BASENAME && . /etc/default/$BASENAME
|
2003-07-09 20:23:35 +00:00
|
|
|
|
2004-09-06 00:32:20 +00:00
|
|
|
test -x $DAEMON || exit 0
|
2003-07-09 20:23:35 +00:00
|
|
|
|
2008-05-27 23:50:18 +00:00
|
|
|
log_daemon_msg() {
|
|
|
|
echo -n "$*"
|
|
|
|
}
|
|
|
|
log_end_msg() {
|
|
|
|
[ "$1" == "0" ] && echo "." || echo " failed!"
|
|
|
|
}
|
|
|
|
log_failure_msg() {
|
|
|
|
echo "$*"
|
|
|
|
}
|
|
|
|
|
|
|
|
test -r /lib/lsb/init-functions && . /lib/lsb/init-functions
|
|
|
|
|
2003-07-09 20:23:35 +00:00
|
|
|
Check_Config()
|
|
|
|
{
|
|
|
|
$DAEMON --configtest >/dev/null 2>&1
|
|
|
|
if [ $? -ne 0 ]; then
|
2008-05-27 23:50:18 +00:00
|
|
|
log_failure_msg "Configuration of $NAME is not valid, won't (re)start!"
|
|
|
|
log_failure_msg "Run \"$DAEMON --configtest\" and fix it up ..."
|
2003-07-09 20:23:35 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2008-05-27 23:50:18 +00:00
|
|
|
if [ ! -d /var/run/ircd ]; then
|
|
|
|
mkdir -p /var/run/ircd
|
|
|
|
chown irc:irc /var/run/ircd
|
2003-07-09 20:23:35 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
Check_Config
|
2008-05-27 23:50:18 +00:00
|
|
|
log_daemon_msg "Starting $DESC" "$NAME"
|
|
|
|
start-stop-daemon --start \
|
|
|
|
--quiet --exec $DAEMON -- $PARAMS
|
|
|
|
log_end_msg $?
|
2003-07-09 20:23:35 +00:00
|
|
|
;;
|
|
|
|
stop)
|
2008-05-27 23:50:18 +00:00
|
|
|
log_daemon_msg "Stopping $DESC" "$NAME"
|
|
|
|
[ -r /var/run/ircd/ngircd.pid ] \
|
|
|
|
&& PIDFILE="--pidfile /var/run/ircd/ngircd.pid" \
|
|
|
|
|| PIDFILE=""
|
|
|
|
start-stop-daemon --stop \
|
|
|
|
--quiet --oknodo --exec $DAEMON $PIDFILE
|
|
|
|
log_end_msg $?
|
2003-07-09 20:23:35 +00:00
|
|
|
;;
|
|
|
|
reload|force-reload)
|
|
|
|
Check_Config
|
2008-05-27 23:50:18 +00:00
|
|
|
log_daemon_msg "Reloading $DESC" "$NAME"
|
2003-07-09 20:23:35 +00:00
|
|
|
start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON
|
2008-05-27 23:50:18 +00:00
|
|
|
log_end_msg $?
|
2003-07-09 20:23:35 +00:00
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
Check_Config
|
2008-05-27 23:50:18 +00:00
|
|
|
log_daemon_msg "Restarting $DESC" "$NAME"
|
|
|
|
[ -r /var/run/ircd/ngircd.pid ] \
|
|
|
|
&& PIDFILE="--pidfile /var/run/ircd/ngircd.pid" \
|
|
|
|
|| PIDFILE=""
|
|
|
|
start-stop-daemon --stop \
|
|
|
|
--quiet --oknodo --exec $DAEMON $PIDFILE
|
2003-07-09 20:23:35 +00:00
|
|
|
sleep 1
|
2008-05-27 23:50:18 +00:00
|
|
|
start-stop-daemon --start \
|
|
|
|
--quiet --exec $DAEMON -- $PARAMS
|
|
|
|
log_end_msg $?
|
2003-07-09 20:23:35 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
N=/etc/init.d/$NAME
|
|
|
|
echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
# -eof-
|