Hi Marc, great work, thanks. Can you create Jira enhacement request with these files attached and description. It'll make sure it doesn't get lost in the emails.
Thanks -- Dejan Bosanac - http://twitter.com/dejanb Open Source Integration - http://fusesource.com/ ActiveMQ in Action - http://www.manning.com/snyder/ Blog - http://www.nighttale.net 2009/11/10 Marc Schöchlin <[email protected]> > Hello ActiveMQ developers, > > i wrote a new initscript for running standalone activemq installations > (see attached script). > > This script is originally based on the scripts "activemq" and > "activemq-admin" located in > "assembly/src/release/bin/" and replaces both scripts. > > Read "usage-examples.txt" for getting a first impression of the > initscript. > > Features of the new script: > - the script should be compatible with cygwin, macosx and most linux and > unix systems > To ensure compatibility to macosx and cygwin it does not utilize lsb > standard infrastructure for controlling daemons like > "start-stop-daemon". > (i tried to keep the shell-syntax compatible to most unix systems, > but only tested on SLES11 and Ubuntu 9.10) > - the complete functionality if "activemq-admin" is now included in > "activemq" > (list, query, browse, ...) > - all option not implemented by the initscript, are directly passed to > the java-call > - the configuration parameters can be located in > /etc/default/activemq.conf or $HOME/.activemqrc > - the script supports operation of multiple instances on the same system > (if the script is symlinked/renamed to > "activemq-instance-<INSTANCENAME>", the configuration > is searched on /etc/default/activemq-instance-<INSTANCENAME>.conf and > $HOME/.activemqrc-instance-<INSTANCENAME>) > - in case of syntax-errors in the configuration, the execution is stopped > - a template configuration for the script can be created by using the > "setup" option > - activemq configuration- and data-dir (e.g. kahadb, tmpstorage) are > configurable > - configuration hints for jmx (because of non-available > "VirtualMachine.attach(PID)", especially needed when using a ibm jvms) > - improved shutdown procedure: script invokes shutdown by a jmx-request, > if process does not disappear > after a configurable timeout, the process is killed by SIGKILL (-9) > - start activemq daemon as an background process : option "start" > - start activemq daemon without daemonizing the daemon: option "fgstart" > - usage of PID files to determine running activemq instances > - the "status" option, checks if there is a running activemq instance > (this is useful for using activemq with high-availability tools) > - the script outputs usage-information if it is invoked without any option > (usage of the java binary combined with the script-usage) > > In my opinion it would be good/nice: > - if this script is will be tested on several unix-systems and on cygwin > - to provide the possibility to configure the entire jmx-setup in > activemq.xml or jetty.xml > (if jetty provides this) > - it would be nice if the java code supports daemonizing > - if this script will be part of activemq, we should adapt the wiki pages > > Feedback and improvement ideas are very welcome :-) > > Best regards > Marc Schoechlin > > > #!/bin/sh > # ------------------------------------------------------------------------ > # Licensed to the Apache Software Foundation (ASF) under one or more > # contributor license agreements. See the NOTICE file distributed with > # this work for additional information regarding copyright ownership. > # The ASF licenses this file to You under the Apache License, Version 2.0 > # (the "License"); you may not use this file except in compliance with > # the License. You may obtain a copy of the License at > # > # http://www.apache.org/licenses/LICENSE-2.0 > # > # Unless required by applicable law or agreed to in writing, software > # distributed under the License is distributed on an "AS IS" BASIS, > # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > # See the License for the specific language governing permissions and > # limitations under the License. > # ------------------------------------------------------------------------ > # > # This script controls standalone Apache ActiveMQ service processes. > # To ensure compatibility to macosx and cygwin we do not utilize > # lsb standard infrastructure for controlling daemons like > # "start-stop-daemon". > # > # See also > http://activemq.apache.org/activemq-command-line-tools-reference.html > # for additional commandline arguments > # > # Authors: > # Marc Schoechlin <[email protected]> > > # ------------------------------------------------------------------------ > # CONFIGURATION > ACTIVEMQ_CONFIGS="/etc/default/activemq.conf $HOME/.activemqrc" > > # For using instances > if ( basename $0 | grep -q "activemq-instance-" );then > INST="$(basename $0|sed 's/^activemq-instance-//;s/\.sh$//')" > ACTIVEMQ_CONFIGS="/etc/default/activemq-instance-${INST}.conf > $HOME/.activemqrc-instance-${INST}" > echo "INFO: using alternative activemq configuration files: > $ACCTIVEMQ_CONFIGS" > fi > > ## START:DEFAULTCONFIG > # ------------------------------------------------------------------------ > # Configuration file for running Apache Active MQ as standalone provider > # > # This file overwrites the predefined settings of the sysv init-script > # > # Active MQ installation dir > ACTIVEMQ_HOME="/opt/activemq" > > # Active MQ configuration directory > ACTIVEMQ_CONFIG_DIR="$ACTIVEMQ_HOME/conf" > > # Active MQ configuration directory > ACTIVEMQ_DATA_DIR="$ACTIVEMQ_HOME/data" > > # Location of the pidfile > ACTIVEMQ_PIDFILE="$ACTIVEMQ_DATA_DIR/activemq.pid" > > # Location of the java installation > # Specify the location of your java installation using JAVA_HOME, or > specify the > # path to the "java" binary using JAVACMD > # (set JAVACMD to "auto" for automatic detection) > #JAVA_HOME="" > JAVACMD="auto" > > # Configure a user with non root priviledges, if no user is specified do > not change user > ACTIVEMQ_USER="" > > # Set jvm memory configuration > ACTIVEMQ_OPTS_MEMORY="-Xms256M -Xmx256M" > > # Set jvm jmx configuration > # This enables jmx access over a configured jmx-tcp-port. > # You have to configure the first four settings if you run a ibm jvm, > caused by the > # fact that IBM's jvm does not support VirtualMachine.attach(PID). > # JMX access is needed for quering a running activemq instance to gain data > or to > # trigger management operations. > # > # Example for ${ACTIVEMQ_CONFIG_DIR}/jmx.access: > # --- > # # The "monitorRole" role has readonly access. > # # The "controlRole" role has readwrite access. > # monitorRole readonly > # controlRole readwrite > # --- > # > # Example for ${ACTIVEMQ_CONFIG_DIR}/jmx.password: > # --- > # # The "monitorRole" role has password "abc123". > # # # The "controlRole" role has password "abcd1234". > # monitorRole abc123 > # controlRole abcd1234 > # --- > # > # ACTIVEMQ_SUNJMX_START="-Dcom.sun.management.jmxremote.port=11099 " > # ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START > -Dcom.sun.management.jmxremote.password.file=${ACTIVEMQ_CONFIG_DIR}/jmx.password" > # ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START > -Dcom.sun.management.jmxremote.access.file=${ACTIVEMQ_CONFIG_DIR}/jmx.access" > # ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START > -Dcom.sun.management.jmxremote.ssl=false" > ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START > -Dcom.sun.management.jmxremote" > > # Set jvm jmx configuration for controlling the broker process > # You only have to configure the first four settings if you run a ibm jvm, > caused by the > # fact that IBM's jvm does not support VirtualMachine.attach(PID) > # (see also com.sun.management.jmxremote.port, .jmx.password.file and > .jmx.access.file ) > #ACTIVEMQ_SUNJMX_CONTROL="--jmxurl service:jmx:rmi:///jndi/rmi:// > 127.0.0.1:11099/jmxrmi --jmxuser controlRole --jmxpassword abcd1234" > ACTIVEMQ_SUNJMX_CONTROL="" > > # Specify the queue manager URL for using "browse" option of sysv > initscript > ACTIVEMQ_QUEUEMANAGERURL="--amqurl tcp://localhost:61616" > > # Set additional JSE arguments > ACTIVEMQ_SSL_OPTS="" > > # Uncomment to enable YourKit profiling > #ACTIVEMQ_DEBUG_OPTS="-agentlib:yjpagent" > > # Uncomment to enable remote debugging > #ACTIVEMQ_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE > -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005" > > # ActiveMQ tries to shutdown the broker by jmx, > # after a specified number of seconds send SIGKILL > ACTIVEMQ_KILL_MAXSECONDS="300" > > ## END:DEFAULTCONFIG > > # ------------------------------------------------------------------------ > # LOAD CONFIGURATION > > # load activemq configuration > CONFIG_LOAD="no" > for ACTIVEMQ_CONFIG in $ACTIVEMQ_CONFIGS; > do > if [ -f "$ACTIVEMQ_CONFIG" ] ; then > ( . $ACTIVEMQ_CONFIG >/dev/null 2>&1 ) > if [ "$?" != "0" ];then > echo "ERROR: there are syntax errors in '$ACTIVEMQ_CONFIG'" > exit 1 > else > echo "INFO: loading '$ACTIVEMQ_CONFIG'" > . $ACTIVEMQ_CONFIG > CONFIG_LOAD="yes" > fi > fi > done > > # inform user thagt no configuration was loaded > if [ "$CONFIG_LOAD" != "yes" ];then > if [ "$1" != "setup" ];then > echo "INFO: using default configuration"; > echo "(you can configure options in one of these file: > $ACTIVEMQ_CONFIGS)" > echo > echo "INFO: invoke the following command to create a configuration > file" > echo "$0 setup [ $(echo $ACTIVEMQ_CONFIGS|sed 's/[ ][ ]*/ | /') ]" > echo > fi > fi > > # create configuration if requested > if [ "$1" = "setup" ];then > if [ -z "$2" ];then > echo "ERROR: specify configuration file" > exit 1 > fi > echo "INFO: creating configuration file: $2" > ( > P_STATE="0" > while read LINE ;do > if (echo "$LINE" | grep "START:DEFAULTCONFIG" >/dev/null );then > P_STATE="1" > continue; > fi > if (echo "$LINE" | grep "END:DEFAULTCONFIG" >/dev/null);then > P_STATE="0" > break; > fi > if [ "$P_STATE" -eq "1" ];then > echo $LINE > fi > done < $0 > ) > $2 > echo "INFO: it's recommend to limit access to '$2' to the priviledged > user" > echo "INFO: (recommended: chown `whoami`:nogroup '$2'; chmod 600 '$2')" > exit $? > fi > > # ------------------------------------------------------------------------ > # OS SPECIFIC SUPPORT > > OSTYPE="unknown" > > case "`uname`" in > CYGWIN*) OSTYPE="cygwin" ;; > Darwin*) > OSTYPE="darwin" > if [ "$JAVACMD" = "auto" ];then > JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home > fi > ;; > esac > > # For Cygwin, ensure paths are in UNIX format before anything is touched > if [ "$OSTYPE" = "cygwin" ]; then > [ -n "$ACTIVEMQ_HOME" ] && > ACTIVEMQ_HOME="`cygpath --unix "$ACTIVEMQ_HOME"`" > [ -n "$JAVA_HOME" ] && > JAVA_HOME="`cygpath --unix "$JAVA_HOME"`" > [ -n "$CLASSPATH" ] && > CLASSPATH="`cygpath --path --unix "$CLASSPATH"`" > fi > > # Detect the location of the java binary > if [ -z "$JAVACMD" ] ; then > if [ -n "$JAVA_HOME" ] ; then > if [ -x "$JAVA_HOME/jre/sh/java" ] ; then > # IBM's JDK on AIX uses strange locations for the executables > JAVACMD="$JAVA_HOME/jre/sh/java" > else > JAVACMD="$JAVA_HOME/bin/java" > fi > fi > fi > > # Hm, we still do not know the location of the java binary > if [ ! -x "$JAVACMD" ] ; then > JAVACMD=`which java 2> /dev/null ` > if [ -z "$JAVACMD" ] ; then > JAVACMD=java > fi > fi > # Stopt here if no java installation is defined/found > if [ ! -x "$JAVACMD" ] ; then > echo "ERROR: configuration varaiable JAVA_HOME or JAVACMD is not defined > correctly." > echo " (JAVA_HOME='$JAVAHOME', JAVACMD='$JAVACMD')" > exit 1 > fi > > echo "INFO: useing java '$JAVACMD'" > > if [ -z "$ACTIVEMQ_BASE" ] ; then > ACTIVEMQ_BASE="$ACTIVEMQ_HOME" > fi > > # For Cygwin, switch paths to Windows format before running java if [ > "$OSTYPE" = "cygwin" ]; then > if [ "$OSTYPE" = "cygwin" ];then > ACTIVEMQ_HOME=`cygpath --windows "$ACTIVEMQ_HOME"` > ACTIVEMQ_BASE=`cygpath --windows "$ACTIVEMQ_BASE"` > ACTIVEMQ_CLASSPATH=`cygpath --path --windows "$ACTIVEMQ_CLASSPATH"` > JAVA_HOME=`cygpath --windows "$JAVA_HOME"` > CLASSPATH=`cygpath --path --windows "$CLASSPATH"` > CYGHOME=`cygpath --windows "$HOME"` > if [ -n "$CYGHOME" ]; then > ACTIVEMQ_CYGWIN="-Dcygwin.user.home=\"$CYGHOME\"" > fi > fi > > # Set default classpath > ACTIVEMQ_CLASSPATH="${ACTIVEMQ_CONFIG_DIR}/;${ACTIVEMQ_CLASSPATH}" > > # Backup invocation parameters > COMMANDLINE_ARGS="$@" > > # ------------------------------------------------------------------------ > # HELPER FUNCTIONS > > # Start the ActiveMQ JAR > # > # This function uses a lot of globally defined variables > invokeJar(){ > local PIDFILE="$1" > local RET="1" > local CUSER="$(whoami)" > > if ( ! [ -f "${ACTIVEMQ_HOME}/bin/run.jar" ] );then > echo "ERROR: '${ACTIVEMQ_HOME}/bin/run.jar' does not exist" > exit 1 > fi > > if ( [ -z "$ACTIVEMQ_USER" ] || [ "$ACTIVEMQ_USER" = "$CUSER" ] );then > DOIT_PREFIX="sh -c " > DOIT_POSTFIX=";" > elif [ "$(id -u)" = "0" ];then > DOIT_PREFIX="su -c " > DOIT_POSTFIX=" - $ACTIVEMQ_USER" > echo "INFO: changing to user '$ACTIVEMQ_USER' to invoke java" > fi > # Execute java binary > if [ -n "$PIDFILE" ];then > $DOIT_PREFIX "cd $ACTIVEMQ_CONFIG_DIR; $JAVACMD $ACTIVEMQ_OPTS > $ACTIVEMQ_DEBUG_OPTS \ > -Dactivemq.classpath=\"${ACTIVEMQ_CLASSPATH}\" \ > -Dactivemq.home=\"${ACTIVEMQ_HOME}\" \ > -Dactivemq.base=\"${ACTIVEMQ_BASE}\" \ > $ACTIVEMQ_CYGWIN \ > -jar \"${ACTIVEMQ_HOME}/bin/run.jar\" $COMMANDLINE_ARGS > >/dev/null 2>&1 & > RET=\"\$?\"; APID=\"\$!\"; > echo \$APID > $PIDFILE; > echo \"INFO: pidfile created : '$PIDFILE' (pid > '\$APID')\";exit \$RET" $DOIT_POSTFIX > RET="$?" > else > $DOIT_PREFIX "cd $ACTIVEMQ_CONFIG_DIR; $JAVACMD $ACTIVEMQ_OPTS > $ACTIVEMQ_DEBUG_OPTS \ > -Dactivemq.classpath=\"${ACTIVEMQ_CLASSPATH}\" \ > -Dactivemq.home=\"${ACTIVEMQ_HOME}\" \ > -Dactivemq.base=\"${ACTIVEMQ_BASE}\" \ > $ACTIVEMQ_CYGWIN \ > -jar \"${ACTIVEMQ_HOME}/bin/run.jar\" $COMMANDLINE_ARGS" > $DOIT_POSTFIX > RET="$?" > fi > return $RET > } > > checkRunning(){ > if [ -f "$ACTIVEMQ_PIDFILE" ]; then > if [ -z "$(cat $ACTIVEMQ_PIDFILE)" ];then > echo "ERROR: pidfile '$ACTIVEMQ_PIDFILE' exists but contains no pid" > return 2 > fi > if (ps -p $(cat $ACTIVEMQ_PIDFILE)|grep java >/dev/null);then > return 0; > else > return 1; > fi > else > return 1; > fi > } > > invoke_status(){ > if ( checkRunning );then > echo "Activemq is running (pid '$(cat $ACTIVEMQ_PIDFILE)')" > exit 0 > fi > echo "Activemq not running" > exit 1 > } > > invoke_start(){ > if ( checkRunning );then > echo "INFO: process with pid '$(cat $ACTIVEMQ_PIDFILE)' is already > running" > exit 0 > fi > > if [ -z "$ACTIVEMQ_OPTS" ] ; then > ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS_MEMORY > -Dorg.apache.activemq.UseDedicatedTaskRunner=true > -Djava.util.logging.config.file=logging.properties" > fi > ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS $ACTIVEMQ_SUNJMX_START $ACTIVEMQ_SSL_OPTS" > echo "INFO: starting - inspect logfiles specified in logging.properties > and log4j.properties to get details" > invokeJar $ACTIVEMQ_PIDFILE > exit "$?" > } > > invoke_fgstart(){ > if ( checkRunning );then > echo "ERROR: activemq is already running" > exit 1 > fi > if [ -z "$ACTIVEMQ_OPTS" ] ; then > ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS_MEMORY > -Dorg.apache.activemq.UseDedicatedTaskRunner=true > -Djava.util.logging.config.file=logging.properties" > fi > ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS $ACTIVEMQ_SUNJMX_START $ACTIVEMQ_SSL_OPTS" > > COMMANDLINE_ARGS="start $(echo $COMMANDLINE_ARGS|sed 's,^fgstart,,')" > echo "INFO: starting in foreeground, this is just for debugging purposes > (stop process by pressing CTRL+c)" > invokeJar > exit "$?" > } > > > invoke_stop(){ > RET="1" > if ( checkRunning );then > ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS $ACTIVEMQ_SSL_OPTS" > COMMANDLINE_ARGS="$COMMANDLINE_ARGS $ACTIVEMQ_SUNJMX_CONTROL" > invokeJar > RET="$?" > echo -n "INFO: waiting at least $ACTIVEMQ_KILL_MAXSECONDS seconds for > regular process termination of pid '$(cat $ACTIVEMQ_PIDFILE)' : " > FOUND="0" > for i in `seq 0 $ACTIVEMQ_KILL_MAXSECONDS` ;do > if (checkRunning);then > sleep 1 > echo -n "." > else > echo " FINISHED" > FOUND="1" > break > fi > done > if [ "$FOUND" -ne "1" ];then > echo "INFO: regular shutdown not successful, sending SIGKILL to > process with pid '$(cat $ACTIVEMQ_PIDFILE)'" > kill -KILL $(cat $ACTIVEMQ_PIDFILE) > RET="1" > fi > elif [ -f "$ACTIVEMQ_PIDFILE" ];then > echo "ERROR: no or outdated process id in '$ACTIVEMQ_PIDFILE'" > echo > echo "INFO: removing $ACTIVEMQ_PIDFILE" > else > exit 0 > fi > rm -f $ACTIVEMQ_PIDFILE >/dev/null 2>&1 > exit $RET > } > > invoke_task(){ > # call task in java binary > if ( checkRunning );then > if [ "$1" = "browse" ] && [ -n "$ACTIVEMQ_QUEUEMANAGERURL" ];then > ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS $ACTIVEMQ_SSL_OPTS" > COMMANDLINE_ARGS="$1 $ACTIVEMQ_QUEUEMANAGERURL $(echo > $COMMANDLINE_ARGS|sed 's,^browse,,')" > elif [ "$1" = "query" ] && [ -n "$ACTIVEMQ_QUEUEMANAGERURL" ];then > ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS $ACTIVEMQ_SSL_OPTS" > COMMANDLINE_ARGS="$1 $ACTIVEMQ_SUNJMX_CONTROL $(echo > $COMMANDLINE_ARGS|sed 's,^query,,')" > else > ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS $ACTIVEMQ_SSL_OPTS" > COMMANDLINE_ARGS="$COMMANDLINE_ARGS $ACTIVEMQ_SUNJMX_CONTROL" > fi > invokeJar > exit $? > else > echo "INFO: activemq not running" > exit 1 > fi > } > > # ------------------------------------------------------------------------ > # MAIN > > # show help > if [ -z "$1" ];then > invokeJar > RET="$?" > cat << EOF > Tasks provided by the sysv init script: > restart - stop running instance (is there is one), start new > instance > fgstart - start daemon in foreground, usful for debugging > purposes > status - check if activemq process is running > setup - create the specified configuration file for this init > script > (see next usage section) > > Configuration of this script: > The configuration of this script can be placed on > /etc/default/activemq.conf or $HOME/.activemqrc. > To use addtional configurations for running multiple instances on the > same operating system > rename or symlink script to a name matching to > activemq-instance-<INSTANCENAME>. > This changes the configuration location to > /etc/default/activemq-instance-<INSTANCENAME>.conf and > \$HOME/.activemqrc-instance-<INSTANCENAME>. Configuration files in /etc > have higher precedence. > EOF > exit $RET > fi > > case "$1" in > status) > invoke_status > ;; > restart) > if ( checkRunning );then > $0 stop > fi > $0 status > $0 start > $0 status > ;; > start) > invoke_start > ;; > fgstart) > invoke_fgstart > ;; > stop) > invoke_stop > ;; > *) > invoke_task > esac > > # vim:ai et ts=2 shiftwidth=2 expandtab tabstop=3: > > $ ./activemq start > INFO: loading '/home/mschoechlin/.activemqrc' > INFO: useing java '/usr/bin/java' > INFO: starting - inspect logfiles specified in logging.properties and > log4j.properties to get details > INFO: pidfile created : > '/home/mschoechlin/temp/apache-activemq-data/activemq.pid' (pid '11283') > > $ ./activemq restart > INFO: loading '/home/mschoechlin/.activemqrc' > INFO: useing java '/usr/bin/java' > INFO: loading '/home/mschoechlin/.activemqrc' > INFO: useing java '/usr/bin/java' > Java Runtime: Sun Microsystems Inc. 1.6.0_16 > /usr/lib/jvm/java-6-sun-1.6.0.16/jre > Heap sizes: current=59776k free=59151k max=886592k > JVM args: > -Dactivemq.classpath=/home/mschoechlin/temp/apache-activemq-data/conf/; > -Dactivemq.home=/home/mschoechlin/temp/apache-activemq-5.3.0 > -Dactivemq.base=/home/mschoechlin/temp/apache-activemq-5.3.0 > ACTIVEMQ_HOME: /home/mschoechlin/temp/apache-activemq-5.3.0 > ACTIVEMQ_BASE: /home/mschoechlin/temp/apache-activemq-5.3.0 > Stopping broker: localhost > INFO: waiting at least 300 seconds for regular process termination of pid > '11283' : FINISHED > INFO: loading '/home/mschoechlin/.activemqrc' > INFO: useing java '/usr/bin/java' > Activemq not running > INFO: loading '/home/mschoechlin/.activemqrc' > INFO: useing java '/usr/bin/java' > INFO: starting - inspect logfiles specified in logging.properties and > log4j.properties to get details > INFO: pidfile created : > '/home/mschoechlin/temp/apache-activemq-data/activemq.pid' (pid '11407') > INFO: loading '/home/mschoechlin/.activemqrc' > INFO: useing java '/usr/bin/java' > Activemq is running (pid '11407') > > $ ./activemq list > INFO: loading '/home/mschoechlin/.activemqrc' > INFO: useing java '/usr/bin/java' > Java Runtime: Sun Microsystems Inc. 1.6.0_16 > /usr/lib/jvm/java-6-sun-1.6.0.16/jre > Heap sizes: current=59776k free=59151k max=886592k > JVM args: > -Dactivemq.classpath=/home/mschoechlin/temp/apache-activemq-data/conf/; > -Dactivemq.home=/home/mschoechlin/temp/apache-activemq-5.3.0 > -Dactivemq.base=/home/mschoechlin/temp/apache-activemq-5.3.0 > ACTIVEMQ_HOME: /home/mschoechlin/temp/apache-activemq-5.3.0 > ACTIVEMQ_BASE: /home/mschoechlin/temp/apache-activemq-5.3.0 > BrokerName = localhost > > $ ./activemq query > INFO: loading '/home/mschoechlin/.activemqrc' > INFO: useing java '/usr/bin/java' > Java Runtime: Sun Microsystems Inc. 1.6.0_16 > /usr/lib/jvm/java-6-sun-1.6.0.16/jre > Heap sizes: current=59776k free=59151k max=886592k > JVM args: > -Dactivemq.classpath=/home/mschoechlin/temp/apache-activemq-data/conf/; > -Dactivemq.home=/home/mschoechlin/temp/apache-activemq-5.3.0 > -Dactivemq.base=/home/mschoechlin/temp/apache-activemq-5.3.0 > ACTIVEMQ_HOME: /home/mschoechlin/temp/apache-activemq-5.3.0 > ACTIVEMQ_BASE: /home/mschoechlin/temp/apache-activemq-5.3.0 > DequeueCount = 0 > Name = ddddddddd > MinEnqueueTime = 0 > CursorMemoryUsage = 0 > MaxAuditDepth = 2048 > Destination = ddddddddd > AverageEnqueueTime = 0.0 > InFlightCount = 0 > MemoryLimit = 1048576 > Type = Queue > EnqueueCount = 0 > MaxEnqueueTime = 0 > MemoryUsagePortion = 0.0 > ProducerCount = 0 > UseCache = true > MaxProducersToAudit = 32 > CursorFull = false > BrokerName = localhost > ConsumerCount = 0 > ProducerFlowControl = true > Subscriptions = [] > QueueSize = 0 > MaxPageSize = 200 > CursorPercentUsage = 0 > MemoryPercentUsage = 0 > DispatchCount = 0 > ExpiredCount = 0 > ... > ... > > $ ./activemq fgstart > INFO: loading '/home/mschoechlin/.activemqrc' > INFO: useing java '/usr/bin/java' > ERROR: activemq is already running > > $ ./activemq stop > INFO: loading '/home/mschoechlin/.activemqrc' > INFO: useing java '/usr/bin/java' > Java Runtime: Sun Microsystems Inc. 1.6.0_16 > /usr/lib/jvm/java-6-sun-1.6.0.16/jre > Heap sizes: current=59776k free=59151k max=886592k > JVM args: > -Dactivemq.classpath=/home/mschoechlin/temp/apache-activemq-data/conf/; > -Dactivemq.home=/home/mschoechlin/temp/apache-activemq-5.3.0 > -Dactivemq.base=/home/mschoechlin/temp/apache-activemq-5.3.0 > ACTIVEMQ_HOME: /home/mschoechlin/temp/apache-activemq-5.3.0 > ACTIVEMQ_BASE: /home/mschoechlin/temp/apache-activemq-5.3.0 > Stopping broker: localhost > INFO: waiting at least 300 seconds for regular process termination of pid > '11407' : FINISHED > > $ ./activemq fgstart > INFO: loading '/home/mschoechlin/.activemqrc' > INFO: useing java '/usr/bin/java' > INFO: starting in foreeground, this is just for debugging purposes (stop > process by pressing CTRL+c) > Java Runtime: Sun Microsystems Inc. 1.6.0_16 > /usr/lib/jvm/java-6-sun-1.6.0.16/jre > Heap sizes: current=251264k free=247327k max=251264k > JVM args: -Xms256M -Xmx256M > -Dorg.apache.activemq.UseDedicatedTaskRunner=true > -Djava.util.logging.config.file=logging.properties > -Dcom.sun.management.jmxremote.port=11099 > -Dcom.sun.management.jmxremote.password.file=/home/mschoechlin/temp/apache-activemq-data/conf/jmx.password > -Dcom.sun.management.jmxremote.access.file=/home/mschoechlin/temp/apache-activemq-data/conf/jmx.access > -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote > -Dactivemq.classpath=/home/mschoechlin/temp/apache-activemq-data/conf/; > -Dactivemq.home=/home/mschoechlin/temp/apache-activemq-5.3.0 > -Dactivemq.base=/home/mschoechlin/temp/apache-activemq-5.3.0 > ACTIVEMQ_HOME: /home/mschoechlin/temp/apache-activemq-5.3.0 > ACTIVEMQ_BASE: /home/mschoechlin/temp/apache-activemq-5.3.0 > Loading message broker from: xbean:activemq.xml > INFO | Using Persistence Adapter: > org.apache.activemq.store.kahadb.kahadbpersistenceadap...@1cb1a4e2 > INFO | Replayed 1 operations from the journal in 0.019 seconds. > INFO | ActiveMQ 5.3.0 JMS Message Broker (localhost) is starting > INFO | For help or more information please see: > http://activemq.apache.org/ > INFO | Listening for connections at: tcp://lt-msch:61616 > INFO | Connector openwire Started > INFO | ActiveMQ JMS Message Broker (localhost, > ID:lt-msch-37931-1257840732525-0:0) started > INFO | Logging to org.slf4j.impl.JCLLoggerAdapter(org.mortbay.log) via > org.mortbay.log.Slf4jLog > INFO | jetty-6.1.9 > INFO | ActiveMQ WebConsole initialized. > INFO | Initializing Spring FrameworkServlet 'dispatcher' > INFO | ActiveMQ Console at http://0.0.0.0:8161/admin > INFO | Initializing Spring root WebApplicationContext > INFO | Connector vm://localhost Started > INFO | Camel Console at http://0.0.0.0:8161/camel > INFO | ActiveMQ Web Demos at http://0.0.0.0:8161/demo > INFO | RESTful file access application at http://0.0.0.0:8161/fileserver > INFO | Started [email protected]:8161 > ^C INFO | ActiveMQ Message Broker (localhost, > ID:lt-msch-37931-1257840732525-0:0) is shutting down > INFO | Connector openwire Stopped > INFO | Connector vm://localhost Stopped > INFO | ActiveMQ JMS Message Broker (localhost, > ID:lt-msch-37931-1257840732525-0:0) stopped > > $ ./activemq setup /tmp/test.config > INFO: loading '/home/mschoechlin/.activemqrc' > INFO: creating configuration file: /tmp/test.config > INFO: it's recommend to limit access to '/tmp/test.config' to the > priviledged user > INFO: (recommended: chown mschoechlin:nogroup '/tmp/test.config'; chmod 600 > '/tmp/test.config') > > $ cat /tmp/test.config > # ------------------------------------------------------------------------ > # Configuration file for running Apache Active MQ as standalone provider > # > # This file overwrites the predefined settings of the sysv init-script > # > # Active MQ installation dir > ACTIVEMQ_HOME="/opt/activemq" > > # Active MQ configuration directory > ACTIVEMQ_CONFIG_DIR="$ACTIVEMQ_HOME/conf" > > # Active MQ configuration directory > ACTIVEMQ_DATA_DIR="$ACTIVEMQ_HOME/data" > > # Location of the pidfile > ACTIVEMQ_PIDFILE="$ACTIVEMQ_DATA_DIR/activemq.pid" > > # Location of the java installation > # Specify the location of your java installation using JAVA_HOME, or > specify the > # path to the "java" binary using JAVACMD > # (set JAVACMD to "auto" for automatic detection) > #JAVA_HOME="" > JAVACMD="auto" > > # Configure a user with non root priviledges, if no user is specified do > not change user > ACTIVEMQ_USER="" > > # Set jvm memory configuration > ACTIVEMQ_OPTS_MEMORY="-Xms256M -Xmx256M" > > # Set jvm jmx configuration > # This enables jmx access over a configured jmx-tcp-port. > # You have to configure the first four settings if you run a ibm jvm, > caused by the > # fact that IBM's jvm does not support VirtualMachine.attach(PID). > # JMX access is needed for quering a running activemq instance to gain data > or to > # trigger management operations. > # > # Example for ${ACTIVEMQ_CONFIG_DIR}/jmx.access: > # --- > # # The "monitorRole" role has readonly access. > # # The "controlRole" role has readwrite access. > # monitorRole readonly > # controlRole readwrite > # --- > # > # Example for ${ACTIVEMQ_CONFIG_DIR}/jmx.password: > # --- > # # The "monitorRole" role has password "abc123". > # # # The "controlRole" role has password "abcd1234". > # monitorRole abc123 > # controlRole abcd1234 > # --- > # > # ACTIVEMQ_SUNJMX_START="-Dcom.sun.management.jmxremote.port=11099 " > # ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START > -Dcom.sun.management.jmxremote.password.file=${ACTIVEMQ_CONFIG_DIR}/jmx.password" > # ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START > -Dcom.sun.management.jmxremote.access.file=${ACTIVEMQ_CONFIG_DIR}/jmx.access" > # ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START > -Dcom.sun.management.jmxremote.ssl=false" > ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START > -Dcom.sun.management.jmxremote" > > # Set jvm jmx configuration for controlling the broker process > # You only have to configure the first four settings if you run a ibm jvm, > caused by the > # fact that IBM's jvm does not support VirtualMachine.attach(PID) > # (see also com.sun.management.jmxremote.port, .jmx.password.file and > .jmx.access.file ) > #ACTIVEMQ_SUNJMX_CONTROL="--jmxurl service:jmx:rmi:///jndi/rmi:// > 127.0.0.1:11099/jmxrmi --jmxuser controlRole --jmxpassword abcd1234" > ACTIVEMQ_SUNJMX_CONTROL="" > > # Specify the queue manager URL for using "browse" option of sysv > initscript > ACTIVEMQ_QUEUEMANAGERURL="--amqurl tcp://localhost:61616" > > # Set additional JSE arguments > ACTIVEMQ_SSL_OPTS="" > > # Uncomment to enable YourKit profiling > #ACTIVEMQ_DEBUG_OPTS="-agentlib:yjpagent" > > # Uncomment to enable remote debugging > #ACTIVEMQ_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE > -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005" > > # ActiveMQ tries to shutdown the broker by jmx, > # after a specified number of seconds send SIGKILL > ACTIVEMQ_KILL_MAXSECONDS="300" > > >
