diff options
author | Ebben Aries <e@dscp.org> | 2018-12-31 14:11:28 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2019-01-05 07:49:17 +0700 |
commit | f226d672557940eba6966bcea8c9f4a0203a4f6c (patch) | |
tree | 861bd4589f883c45afc6d9bda33a4b07e4a7e2dc /network/ircd-hybrid/rc.ircd.new | |
parent | 01f09cbeec562d978f78f636e1eeed9c0d6e50c8 (diff) |
network/ircd-hybrid: Added (IRC daemon).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
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 |