BB Unix Network Monitor - Message
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
{bb} Scripting BB startup/shutdown in Red Hat
- To: bb@bb4.com
- Subject: {bb} Scripting BB startup/shutdown in Red Hat
- From: Shane Presley <shane.presley@gmail.com>
- Date: Tue, 21 Dec 2004 08:15:01 -0500
- Content-transfer-encoding: 7bit
- Content-type: text/plain; charset=US-ASCII
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; b=M1M10DQXDQRAw0kSCVVjWFVbdwzk9xZBRynyJljcOgAvu2MSxoabCck1/Eif2m81yWcCyfu743DEIWqzmoENyVzVtyLqu8wtvgjHCDLnaJPS7B4nUyOo6JF4oQJCBN2n+bxmVmgCQB/wPZzymoCMCWvOY+riW81bgmavTVKr3SM=
- Reply-to: bb@bb4.com
- Sender: owner-bb@bb4.com
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