#!/bin/bash # # whosond Start/Stop whosond server # # chkconfig: 345 40 65 # description: whosond - implementation of WHOSON protocol # # processname: whosond # config: /etc/whoson.conf # Source function library . /etc/rc.d/init.d/functions # Get network config . /etc/sysconfig/network # Get service config [ -f /etc/sysconfig/whoson ] && . /etc/sysconfig/whoson # Check that networking is up. if is_yes "${NETWORKING}"; then if [ ! -f /var/lock/subsys/network ]; then msg_network_down whosond exit 1 fi else exit 0 fi RETVAL=0 # See how we were called. case "$1" in start) # Check if the service is already running? if [ ! -f /var/lock/subsys/whosond ]; then msg_starting "whosond" daemon whosond RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/whosond else msg_already_running whosond fi ;; stop) if [ -f /var/lock/subsys/whosond ]; then # Stop daemons. msg_stopping whosond killproc whosond rm -f /var/lock/subsys/whosond >/dev/null 2>&1 else msg_not_running whosond fi ;; restart) $0 stop $0 start exit $? ;; reload|force-reload) if [ -f /var/lock/subsys/whosond ]; then msg_reloading whosond killproc whosond -HUP RETVAL=$? else msg_not_running whosond >&2 exit 7 fi ;; status) status whosond exit $? ;; *) # show "Usage: %s {start|stop|restart|reload|force-reload|status}" msg_usage "$0 {start|stop|restart|reload|force-reload|status}" exit 3 esac exit $RETVAL