mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-07 20:27:02 +01:00
f226d67255
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
73 lines
1.1 KiB
Bash
73 lines
1.1 KiB
Bash
#!/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
|