102 lines
2.1 KiB
Bash
Executable File
102 lines
2.1 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# ngIRCd start and stop script for Debian-based systems
|
|
#
|
|
|
|
### BEGIN INIT INFO
|
|
# Provides: ircd
|
|
# Required-Start: $remote_fs
|
|
# Required-Stop: $remote_fs
|
|
# Should-Start: $syslog
|
|
# Should-Stop: $syslog
|
|
# Default-Start: 2 3 4 5
|
|
# Default-Stop: 0 1 6
|
|
# Short-Description: Next Generation IRC Server
|
|
### END INIT INFO
|
|
|
|
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
|
DAEMON=/usr/sbin/ngircd
|
|
NAME=ngIRCd
|
|
DESC="IRC daemon"
|
|
PARAMS=""
|
|
|
|
test -h "$0" && me=`readlink $0` || me="$0"
|
|
BASENAME=`basename $me`
|
|
|
|
test -r /etc/default/$BASENAME && . /etc/default/$BASENAME
|
|
|
|
test -x $DAEMON || exit 0
|
|
|
|
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
|
|
|
|
Check_Config()
|
|
{
|
|
$DAEMON --configtest >/dev/null 2>&1
|
|
if [ $? -ne 0 ]; then
|
|
log_failure_msg "Configuration of $NAME is not valid, won't (re)start!"
|
|
log_failure_msg "Run \"$DAEMON --configtest\" and fix it up ..."
|
|
exit 1
|
|
fi
|
|
if [ ! -d /var/run/ircd ]; then
|
|
mkdir -p /var/run/ircd
|
|
chown irc:irc /var/run/ircd
|
|
fi
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
Check_Config
|
|
log_daemon_msg "Starting $DESC" "$NAME"
|
|
start-stop-daemon --start \
|
|
--quiet --exec $DAEMON -- $PARAMS
|
|
log_end_msg $?
|
|
;;
|
|
stop)
|
|
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 $?
|
|
;;
|
|
reload|force-reload)
|
|
Check_Config
|
|
log_daemon_msg "Reloading $DESC" "$NAME"
|
|
start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON
|
|
log_end_msg $?
|
|
;;
|
|
restart)
|
|
Check_Config
|
|
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
|
|
sleep 1
|
|
start-stop-daemon --start \
|
|
--quiet --exec $DAEMON -- $PARAMS
|
|
log_end_msg $?
|
|
;;
|
|
*)
|
|
N=/etc/init.d/$NAME
|
|
echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0
|
|
|
|
# -eof-
|