Fixes AMQ-4806: './bin/activemq console' should 'exec' java so that way scripts calling it can get the pid for the broker's java process.

This commit is contained in:
Hiram Chirino 2013-10-15 10:54:58 -04:00
parent 864aa6798f
commit ee65ca4ee5
1 changed files with 5 additions and 3 deletions

View File

@ -33,6 +33,7 @@ ACTIVEMQ_CONFIGS="/etc/default/activemq $HOME/.activemqrc"
# Backup invocation parameters
COMMANDLINE_ARGS="$@"
EXEC_OPTION=""
# For using instances
if ( basename $0 | grep "activemq-instance-" > /dev/null);then
@ -393,7 +394,7 @@ invokeJar(){
fi
# Execute java binary
if [ -n "$PIDFILE" ] && [ "$PIDFILE" != "stop" ];then
$DOIT_PREFIX "$JAVACMD $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \
$EXEC_OPTION $DOIT_PREFIX "$JAVACMD $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \
-Dactivemq.classpath=\"${ACTIVEMQ_CLASSPATH}\" \
-Dactivemq.home=\"${ACTIVEMQ_HOME}\" \
-Dactivemq.base=\"${ACTIVEMQ_BASE}\" \
@ -407,7 +408,7 @@ invokeJar(){
RET="$?"
elif [ -n "$PIDFILE" ] && [ "$PIDFILE" = "stop" ];then
PID=`cat $ACTIVEMQ_PIDFILE`
$DOIT_PREFIX "$JAVACMD $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \
$EXEC_OPTION $DOIT_PREFIX "$JAVACMD $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \
-Dactivemq.classpath=\"${ACTIVEMQ_CLASSPATH}\" \
-Dactivemq.home=\"${ACTIVEMQ_HOME}\" \
-Dactivemq.base=\"${ACTIVEMQ_BASE}\" \
@ -419,7 +420,7 @@ invokeJar(){
echo \$APID > $ACTIVEMQ_DATA/stop.pid; exit \$RET" $DOIT_POSTFIX
RET="$?"
else
$DOIT_PREFIX "$JAVACMD $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \
$EXEC_OPTION $DOIT_PREFIX "$JAVACMD $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \
-Dactivemq.classpath=\"${ACTIVEMQ_CLASSPATH}\" \
-Dactivemq.home=\"${ACTIVEMQ_HOME}\" \
-Dactivemq.base=\"${ACTIVEMQ_BASE}\" \
@ -543,6 +544,7 @@ invoke_console(){
ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS $ACTIVEMQ_SUNJMX_START $ACTIVEMQ_SSL_OPTS -Djava.awt.headless=true -Djava.io.tmpdir=\"${ACTIVEMQ_TMP}\""
COMMANDLINE_ARGS="start `echo $COMMANDLINE_ARGS|sed 's,^console,,'`"
EXEC_OPTION="exec"
echo "INFO: Starting in foreground, this is just for debugging purposes (stop process by pressing CTRL+C)"
invokeJar
exit "$?"