diff options
Diffstat (limited to 'network/ircd-hybrid/rc.ircd.new')
-rw-r--r-- | network/ircd-hybrid/rc.ircd.new | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/network/ircd-hybrid/rc.ircd.new b/network/ircd-hybrid/rc.ircd.new new file mode 100644 index 0000000000000..9011ea85335c6 --- /dev/null +++ b/network/ircd-hybrid/rc.ircd.new @@ -0,0 +1,73 @@ +#!/bin/sh +# +# ircd-hybrid startup script for Slackware Linux + +NAME=ircd +DAEMON=/usr/bin/$NAME +PIDFILE=/var/run/$NAME/${NAME}.pid +LOGFILE=/var/log/$NAME/${NAME}.log +CONF=/etc/$NAME/${NAME}.conf +DAEMON_ARGS="-pidfile $PIDFILE -logfile $LOGFILE" + +ircd_start() { + if [! -r $CONF ]; then + echo "$CONF does not appear to exist. Abort." + exit 1 + fi + + if [ -s $PIDFILE ]; then + echo "$NAME appears to already be running?" + exit 1 + fi + + echo "Starting IRC daemon ..." + sudo -u $NAME $DAEMON $DAEMON_ARGS +} + +ircd_stop() { + if [ ! -s $PIDFILE ]; then + echo "$PIDFILE does not exist or is empty." + exit 1 + fi + + echo -n "Stopping IRC daemon..." + if [ -r $PIDFILE ]; then + kill $(cat $PIDFILE) + rm -f $PIDFILE + else + pkill ircd + fi + echo " done" +} + +ircd_restart() { + ircd_stop + sleep 1 + ircd_start +} + +ircd_status() { + if [ -e $PIDFILE ]; then + echo "ircd is running." + else + echo "ircd is stopped." + exit 1 + fi +} + +case "$1" in +'start') + ircd_start + ;; +'stop') + ircd_stop + ;; +'restart') + ircd_restart + ;; +'status') + ircd_status + ;; +*) + echo "usage $0 start|stop|restart|status" +esac |