You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by David Blundell <da...@100percentit.com> on 2007/07/04 20:11:00 UTC
ActiveMQ 5 - Unix daemon
I am testing ActiveMQ 5 (20070702.220514-14) on RHEL 64 bit.
As the shutdown script is not present in ./bin I tried to use the
./bin/linux/activemq wrapper to start the program as a daemon. I got an
error that libwrapper.so could not be loaded as it was a 32 bit Wrapper. To
fix this I added the latest 64 bit release of wrapper (3.2.3).
This allowed me to run "./bin/linux/activemq start" without errors but
ActiveMQ was not started. The log just showed that the wrapper stopped.
When I turned on debugging I could not see anything wrong - the only lines
that seemed relevant were:
INFO | jvm 1 | 2007/07/03 23:29:51 | WrapperSimpleApp: main method
completed
INFO | jvm 1 | 2007/07/03 23:29:51 | WrapperSimpleApp: start(args) end.
Main Completed=true, exitCode=null
INFO | jvm 1 | 2007/07/03 23:29:51 | WrapperListener.start runner
thread stopped.
...
DEBUG | wrapper | 2007/07/03 23:29:54 | Signal trapped. Details:
DEBUG | wrapper | 2007/07/03 23:29:54 | signal number=17 (SIGCHLD),
source="unknown"
I tried setting up the same snapshot of ActiveMQ on OS X 10.4.10 and while
the 32 bit libwrapper.so worked fine I had a similar lack of results (other
than receiving "signal number=20" rather than 17).
I could not find any relevant open issues on the wrapper or the shutdown
script so it may be that I'm missing something obvious.
I wanted to run ActiveMQ as a daemon and log all output to syslog with a
prefix of "activemq". As I could not get the wrapper to work I added an
activemq user and wrote a new init.d file. It is similar to the details at
http://activemq.apache.org/unix-service.html but it works for ActiveMQ 5
snapshots where shutdown is not present. It also outputs everything to
syslog and adds "status" to the existing start, stop and restart commands:
#!/bin/bash
#
# chkconfig: 345 99 01
# description: Message queue
#
PROG=activemq
PROG_USER=activemq
DAEMON_HOME=/opt/activemq
DAEMON=$DAEMON_HOME/bin/$PROG
LOCKFILE=/var/lock/subsys/$PROG
PIDFILE=/var/run/$PROG.pid
test -x $DAEMON || exit 0
# Source function library.
. /etc/rc.d/init.d/functions
RETVAL=0
usage () {
echo "Usage: service $PROG {start|stop|restart|status}"
RETVAL=1
}
start () {
echo -n $"Starting $PROG: "
if [ ! -e $LOCKFILE ]; then
cd $DAEMON_HOME
sudo -u $PROG_USER $DAEMON > >(logger -t $PROG) 2>&1 &
else
echo -n "Lockfile exists"
false
fi
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
logger -t activemq "starting $PROG."
echo $! > $PIDFILE
touch $LOCKFILE
else
logger -t activemq "unable to start $PROG."
fi
[ $RETVAL -eq 0 ] && success $"$PROG startup" || failure $"$PROG
startup"
echo
}
stop () {
echo -n "Shutting down $PROG: "
killproc -p $PIDFILE -d 20
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f $LOCKFILE
}
case "$1" in
start) start ;;
stop) stop ;;
restart|reload)
stop
start
;;
status)
status $PROG -p $PIDFILE
RETVAL=$?
;;
*) usage ;;
esac
exit $RETVAL
My questions are: Am I doing something wrong with the wrapper? Has the
shutdown script been removed permanently (if so I hope the init script above
helps)?
Thanks, David.
--
View this message in context: http://www.nabble.com/ActiveMQ-5---Unix-daemon-tf4025839s2354.html#a11435292
Sent from the ActiveMQ - User mailing list archive at Nabble.com.