BB Unix Network Monitor - Message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: {bb} Scripting BB startup/shutdown in Red Hat



Hi,

I use the following simple start/stop script:

#!/bin/sh
#
#       Start script for Big Brother and Tools on LINUX
#
#       Johann Eggers (jeg), 22.08.2002

BBHOME=/opt/bb

case "$1" in

'start')
       su bb -c "/opt/bb/runbb.sh $1"
       ;;

'stop')
       su bb -c "/opt/bb/runbb.sh $1"
       ;;

'restart')
       su bb -c "/opt/bb/runbb.sh $1"
       ;;
*)
       echo "Usage: $0 [start|stop|restart]"
       ;;
esac

Johann

Shane Presley wrote:

Hello,

I created a service defintion for BB in RedHat, and used this startup script:

#!/bin/bash
#
# bb      This shell script takes care of starting and stopping
#             standalone BigBrother.
#
# chkconfig: - 89 16
# description: BigBrother is a network monitoring daemon
# processname: runbb.sh

start() {
       # Start daemons.

       su - bb -c "/usr/local/bb/bb/runbb.sh start"
       return $RETVAL
}

stop() {
       # Stop daemons.
       su - bb -c "/usr/local/bb/bb/runbb.sh stop"
       return $RETVAL
}

# See how we were called.
case "$1" in
 start)
       start
       ;;
 stop)
       stop
       ;;
 restart|reload)
       stop
       start
       RETVAL=$?
       ;;
 status)
       status $prog
       RETVAL=$?
       ;;
 *)
       echo $"Usage: $prog {start|stop|restart|reload|status}"
       exit 1
esac

exit $RETVAL




It works great to start the service (running as bb not root). However, when I try to use this script to stop the service, it doesn't
shut down cleanly:
service bb stop
Stopping Big Brother...
/usr/local/bb/bb/runbb.sh: line 145: kill: (12372) - Operation not permitted
/usr/local/bb/bb/runbb.sh: line 145: kill: (12235) - No such process
/usr/local/bb/bb/runbb.sh: line 145: kill: (12372) - Operation not permitted
/usr/local/bb/bb/runbb.sh: line 145: kill: (12373) - No such process
/usr/local/bb/bb/runbb.sh: line 145: kill: (12235) - No such process
/usr/local/bb/bb/runbb.sh: line 145: kill: (12372) - No such process



Specifically, it does kill all the BB processes, but it leaves BBPID, so that BB thinks it is still running. It also creates runbb.sh.12373 with this info:

cat runbb.sh.12373
12235 pts/1    S      0:00 /bin/sh /usr/local/bb/bb/runbb.sh start
12372 pts/1    S      0:00 su - bb -c /usr/local/bb/bb/runbb.sh stop
12373 pts/1    S      0:00 /bin/sh /usr/local/bb/bb/runbb.sh stop
12235 pts/1    S      0:00 /bin/sh /usr/local/bb/bb/runbb.sh start
12372 pts/1    S      0:00 su - bb -c /usr/local/bb/bb/runbb.sh stop
12373 pts/1    S      0:00 /bin/sh /usr/local/bb/bb/runbb.sh stop
12235 pts/1    S      0:00 /bin/sh /usr/local/bb/bb/runbb.sh start
12372 pts/1    S      0:00 su - bb -c /usr/local/bb/bb/runbb.sh stop
12373 pts/1    S      0:00 /bin/sh /usr/local/bb/bb/runbb.sh stop

So BB is really stopped, but if I try a bb start, it says that it's
already running. I have to wipe out BBPID to get it started again. Also, if I run runbb.sh stop manually, it works fine. Its only in my
script that it fails.


Any idea where my problem might be? Thanks,
Shane



-- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-= To unsubscribe from this list, or to subscribe to the bb-digest list send e-mail to mailto:majordomo@bb4.com with unsubscribe bb -and/or- subscribe bb-digest in the BODY of the message.


Home | Main Index | Thread Index