-
-
Save koi-chan/7cb1a01b7a99928263e4 to your computer and use it in GitHub Desktop.
charybdis-sysvinit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# charybdis Startup script for the ircd server | |
# | |
# chkconfig: - 85 15 | |
# description: charybdis IRC daemon | |
# | |
# processname: ircd | |
# config: /home/charybdis/ircd/etc/ircd.conf | |
# pidfile: /home/charybdis/ircd/etc/ircd.pid | |
# Source function library | |
. /etc/rc.d/init.d/functions | |
USER="charybdis" | |
HOME="/home/$USER" | |
prog="ircd" | |
ircd="$HOME/ircd/bin/ircd" | |
if [ -f $HOME/ircd/etc/sysconfig ]; then | |
. $HOME/ircd/etc/sysconfig | |
fi | |
if [ -z "$PIDFILE" ]; then | |
PIDFILE=$HOME/ircd/etc/ircd.pid | |
fi | |
RETVAL=0 | |
start() { | |
echo -n $"Starting $prog: " | |
touch $PIDFILE | |
chown $USER $PIDFILE | |
daemon --user $USER $ircd -pidfile $PIDFILE | |
RETVAL=$? | |
echo | |
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog | |
return $RETVAL | |
} | |
stop() { | |
echo -n $"Stopping $prog: " | |
killproc $ircd | |
RETVAL=$? | |
echo | |
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog | |
return $RETVAL | |
} | |
reload() { | |
echo -n $"Reloading $prog: " | |
killproc $ircd -HUP | |
RETVAL=$? | |
echo | |
return $RETVAL | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
stop | |
start | |
;; | |
condrestart) | |
if [ -f /var/lock/subsys/$prog ]; then | |
stop | |
start | |
fi | |
;; | |
reload) | |
reload | |
;; | |
rehash) | |
reload | |
;; | |
status) | |
status $ircd | |
RETVAL=$? | |
;; | |
*) | |
echo $"Usage: $0 {start|stop|restart|condrestart|reload|rehash|status}" | |
RETVAL=1 | |
esac | |
exit $RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment