#!/bin/sh # # bb Big Brother System and Network Monitor # # chkconfig: 345 95 01 # description: Big Brother is System and Network Monitoring system # processname: bbd # Source function library . /etc/rc.d/init.d/functions # Get network config . /etc/sysconfig/network # Get service config [ -f /etc/sysconfig/bb ] && . /etc/sysconfig/bb # Check that networking is up. if is_yes "${NETWORKING}"; then if [ ! -f /var/lock/subsys/network ]; then msg_network_down bb exit 1 fi else exit 0 fi # See how we were called. case "$1" in start) # Check if the service is already running? if [ ! -f /var/lock/subsys/bb ]; then msg_starting bb su - bb -c '/usr/bin/setsid /usr/lib/bb/runbb.sh start' /dev/null 2>&1 RETVAL=$? [ $RETVAL -eq 0 ] && ok || fail [ $RETVAL -eq 0 ] && touch /var/lock/subsys/bb else msg_already_running bb fi ;; stop) # Stop daemons. if [ -f /var/lock/subsys/bb ]; then msg_stopping bb su - bb -c '/usr/lib/bb/runbb.sh stop' >/dev/null 2>&1 [ $? -eq 0 ] && ok || died rm -f /var/lock/subsys/bb >/dev/null 2>&1 else msg_not_running bb fi ;; status) ;; restart|force-reload) $0 stop $0 start exit $? ;; *) msg_usage "$0 {start|stop|restart|force-reload|status}" exit 3 ;; esac exit $RETVAL