#!/bin/sh # # atheme atheme IRC Services # # chkconfig: 345 85 15 # description: atheme is an IRC services daemon. # # Source function library . /etc/rc.d/init.d/functions # Get network config . /etc/sysconfig/network # Get service config [ -f /etc/sysconfig/atheme ] && . /etc/sysconfig/atheme # Check that networking is up. if is_yes "${NETWORKING}"; then if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then msg_network_down atheme exit 1 fi else exit 0 fi start() { daemon --user atheme atheme RETVAL=$? if [ $RETVAL -eq 0 ]; then touch /var/lock/subsys/atheme fi return $RETVAL } stop() { killproc --pidfile /var/run/atheme.pid atheme rm -f /var/lock/subsys/atheme >/dev/null 2>&1 } reload() { # sending INT signal will make atheme close all listening sockets and # wait for client connections to terminate. killproc --pidfile /var/run/atheme.pid atheme -HUP } RETVAL=0 # See how we were called. case "$1" in start) # Check if the service is already running? if [ ! -f /var/lock/subsys/atheme ]; then msg_starting atheme start else msg_already_running atheme fi ;; stop) # Stop daemons. if [ -f /var/lock/subsys/atheme ]; then msg_stopping atheme stop else msg_not_running atheme fi ;; status) status atheme RETVAL=$? ;; restart) if [ -f /var/lock/subsys/atheme ]; then msg_stopping atheme stop msg_starting atheme start RETVAL=$? else msg_not_running atheme msg_starting atheme start fi ;; reload|graceful|force-reload) if [ -f /var/lock/subsys/atheme ]; then msg_reloading atheme reload RETVAL=$? else msg_not_running atheme RETVAL=7 fi ;; flush-logs) if [ -f /var/lock/subsys/atheme ]; then nls "Rotating %s logs" atheme killproc --pidfile /var/run/atheme.pid atheme -HUP RETVAL=$? else msg_not_running atheme RETVAL=7 fi ;; *) msg_usage "$0 {start|stop|restart|reload|force-reload|graceful|flush-logs|status}" exit 3 ;; esac exit $RETVAL