mirror of
https://github.com/osmarks/ngircd.git
synced 2024-12-12 09:50:29 +00:00
ngircd.init: use LSB logging functions, if available.
This commit is contained in:
parent
6f7b669bec
commit
12f5b0579b
@ -2,15 +2,13 @@
|
|||||||
#
|
#
|
||||||
# ngIRCd start and stop script for Debian-based systems
|
# ngIRCd start and stop script for Debian-based systems
|
||||||
#
|
#
|
||||||
# $Id: ngircd.init,v 1.7 2006/12/26 14:43:46 alex Exp $
|
|
||||||
#
|
|
||||||
|
|
||||||
### BEGIN INIT INFO
|
### BEGIN INIT INFO
|
||||||
# Provides: ircd
|
# Provides: ircd
|
||||||
# Required-Start: $local_fs
|
# Required-Start: $remote_fs
|
||||||
# Required-Stop: $local_fs
|
# Required-Stop: $remote_fs
|
||||||
# Should-Start: $syslog $network
|
# Should-Start: $syslog
|
||||||
# Should-Stop: $syslog $network
|
# Should-Stop: $syslog
|
||||||
# Default-Start: 2 3 4 5
|
# Default-Start: 2 3 4 5
|
||||||
# Default-Stop: 0 1 6
|
# Default-Stop: 0 1 6
|
||||||
# Short-Description: Next Generation IRC Server
|
# Short-Description: Next Generation IRC Server
|
||||||
@ -25,54 +23,71 @@ PARAMS=""
|
|||||||
test -h "$0" && me=`readlink $0` || me="$0"
|
test -h "$0" && me=`readlink $0` || me="$0"
|
||||||
BASENAME=`basename $me`
|
BASENAME=`basename $me`
|
||||||
|
|
||||||
test -f /etc/default/$BASENAME && . /etc/default/$BASENAME
|
test -r /etc/default/$BASENAME && . /etc/default/$BASENAME
|
||||||
|
|
||||||
test -x $DAEMON || exit 0
|
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()
|
Check_Config()
|
||||||
{
|
{
|
||||||
$DAEMON --configtest >/dev/null 2>&1
|
$DAEMON --configtest >/dev/null 2>&1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Configuration of $NAME is not valide, won't (re)start!"
|
log_failure_msg "Configuration of $NAME is not valid, won't (re)start!"
|
||||||
echo "Please run \"$DAEMON --configtest\" manually and fix it up ..."
|
log_failure_msg "Run \"$DAEMON --configtest\" and fix it up ..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
if [ ! -d /var/run/ircd ]; then
|
||||||
|
mkdir -p /var/run/ircd
|
||||||
Try_Start()
|
chown irc:irc /var/run/ircd
|
||||||
{
|
|
||||||
[ ! -d /var/run/ircd ] || chown irc:irc /var/run/ircd
|
|
||||||
start-stop-daemon --start --quiet --exec $DAEMON -- $PARAMS
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "$NAME failed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
echo "$NAME."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
Check_Config
|
Check_Config
|
||||||
echo -n "Starting $DESC: "
|
log_daemon_msg "Starting $DESC" "$NAME"
|
||||||
Try_Start
|
start-stop-daemon --start \
|
||||||
|
--quiet --exec $DAEMON -- $PARAMS
|
||||||
|
log_end_msg $?
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
echo -n "Stopping $DESC: "
|
log_daemon_msg "Stopping $DESC" "$NAME"
|
||||||
start-stop-daemon --stop --quiet --pidfile /var/run/ircd/ngircd.pid --exec $DAEMON \
|
[ -r /var/run/ircd/ngircd.pid ] \
|
||||||
&& echo "$NAME." \
|
&& PIDFILE="--pidfile /var/run/ircd/ngircd.pid" \
|
||||||
|| echo "(none running)"
|
|| PIDFILE=""
|
||||||
|
start-stop-daemon --stop \
|
||||||
|
--quiet --oknodo --exec $DAEMON $PIDFILE
|
||||||
|
log_end_msg $?
|
||||||
;;
|
;;
|
||||||
reload|force-reload)
|
reload|force-reload)
|
||||||
Check_Config
|
Check_Config
|
||||||
echo "Reloading $DESC configuration files."
|
log_daemon_msg "Reloading $DESC" "$NAME"
|
||||||
start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON
|
start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON
|
||||||
|
log_end_msg $?
|
||||||
;;
|
;;
|
||||||
restart)
|
restart)
|
||||||
Check_Config
|
Check_Config
|
||||||
echo -n "Restarting $DESC: "
|
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||||
start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
|
[ -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
|
sleep 1
|
||||||
Try_Start
|
start-stop-daemon --start \
|
||||||
|
--quiet --exec $DAEMON -- $PARAMS
|
||||||
|
log_end_msg $?
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
N=/etc/init.d/$NAME
|
N=/etc/init.d/$NAME
|
||||||
|
Loading…
Reference in New Issue
Block a user