#!/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_no "${NETWORKING}"; then # nls "ERROR: Networking is down. %s can't be run." msg_network_down bb exit 1 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=$? if [ "$RETVAL" = "0" ]; then ok else fail fi [ $RETVAL -eq 0 ] && touch /var/lock/subsys/bb else msg_already_running bb exit 1 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 if [ "$?" = "0" ]; then ok else fail fi rm -f /var/lock/subsys/bb >/dev/null 2>&1 else msg_not_running bb exit 1 fi ;; restart|reload) $0 stop $0 start ;; *) msg_usage "$0 {start|stop|restart}" exit 1 ;; esac exit $RETVAL