1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
#!/bin/sh
### BEGIN INIT INFO
# Provides: sbnc
# Required-Start: $local_fs $remote_fs $network $time
# Required-Stop: $local_fs $remote_fs $network $time
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: An modular IRC proxy.
# Description: shroudBNC (short: sbnc) is an modular IRC proxy with
# features like OpenSSL encrypted connections for the client
# and the server, IPv6 and support for scripting extensions.
# The daemon is able to handle more than 2000 connections at
# the same time.
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=/usr/sbin/sbnc
PIDFILE=/var/run/sbnc/sbnc.pid
USER=sbnc
OPTIONS="--config /etc/sbnc/ --log /var/log/sbnc/ --pid $PIDFILE"
. /lib/lsb/init-functions
# See if the daemons are there
test -f ${NAME} || exit 0
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
if [ -r "/lib/lsb/init-functions" ]; then
. "/lib/lsb/init-functions"
. "/lib/init/vars.sh"
else
echo "Could not read file /lib/lsb/init-functions. Please install lsb-base."
exit 1
fi
# Check for default file of sbnc.
if [ -f /etc/default/sbnc ] ; then
. /etc/default/sbnc
else
echo "Could not read file /etc/default/sbnc."
exit 1
fi
# Create needed dir in /var/run.
if [ ! -d /var/run/sbnc ] ; then
mkdir /var/run/sbnc
chown sbnc:sbnc /var/run/sbnc
chmod 0760 /var/run/sbnc
fi
case "$1" in
start)
if [ "$AUTOSTART_SBNC" != "1" ] ; then
log_warning_msg "Not starting sbnc, it is disabled in /etc/default/sbnc"
exit 0
fi
echo -n "Starting sbnc daemon:"
echo -n " sbnc"
start-stop-daemon --start --background --chuid ${USER} --exec ${NAME} -- $OPTIONS
echo "."
;;
stop)
echo -n "Stopping sbnc daemon:"
echo -n " sbnc"
start-stop-daemon --stop --quiet --chuid ${USER} --exec ${NAME}
echo "."
;;
reload|restart|force-reload)
if [ "$AUTOSTART_SBNC" != "1" ] ; then
log_warning_msg "Not starting sbnc, it is disabled in /etc/default/sbnc"
exit 0
fi
echo -n "Restarting sbnc daemon:"
echo -n " sbnc"
start-stop-daemon --stop --quiet --chuid ${USER} --exec ${NAME}
sleep 2
start-stop-daemon --start --quiet --background --chuid ${USER} --exec ${NAME}
echo "."
;;
status)
status_of_proc -p $PIDFILE "sbnc" "sbnc"
exit $?
;;
*)
echo "Usage: $0 {start|stop|restart|reload|force-reload}"
exit 1
;;
esac
exit 0
|