The following commit has been merged in the master branch:
commit 03e281cce803c5bba8dc207829df593edbe444b1
Author: Damien Raude-Morvan <draz...@debian.org>
Date:   Wed Oct 26 21:14:15 2011 +0200

    d/activemq.init: Merge change proposed by Jonas Genannt to allow console 
startup, useful for debugging purposes. (Closes: #645241).

diff --git a/debian/activemq.README.Debian b/debian/activemq.README.Debian
index c71d82a..9307a78 100644
--- a/debian/activemq.README.Debian
+++ b/debian/activemq.README.Debian
@@ -31,6 +31,17 @@ Enable it:
 Start it :
   invoke-rc.d activemq start
 
+
+Debug an ActiveMQ instance
+--------------------------
+
+You can start any ActiveMQ instance in foreground for debugging.
+
+Start instance `foo` in forground:
+
+  # /etc/init.d/activemq console foo
+
+
 Setup a new ActiveMQ instance
 -----------------------------
 
diff --git a/debian/activemq.init b/debian/activemq.init
index 3d4a45b..cc57c68 100644
--- a/debian/activemq.init
+++ b/debian/activemq.init
@@ -141,23 +141,32 @@ start_servers() {
        done
 }
 
+
+# Stops an running Instance
+stop_server() {
+       INSTANCE=$1
+       ACTIVEMQ_PIDFILE="/var/run/activemq/$INSTANCE.pid"
+
+       start-stop-daemon --stop --quiet --pidfile $ACTIVEMQ_PIDFILE \
+               --user $ACTIVEMQ_USER \
+               --name java --startas $DAEMON -- stop
+       if running; then
+               force_stop
+       fi
+       if running; then
+               log_progress_msg "(failed)"
+       else
+               log_progress_msg "(stopped)"
+       fi
+}
+
 # Stop the process using the wrapper
 stop_servers() {
        for INSTANCE in `ls /var/run/activemq/`; do
                INSTANCE=$(echo $INSTANCE | sed 's@.pid@@')
-               ACTIVEMQ_PIDFILE="/var/run/activemq/$INSTANCE.pid"
                log_progress_msg "$INSTANCE"
-               start-stop-daemon --stop --quiet --pidfile $ACTIVEMQ_PIDFILE \
-                       --user $ACTIVEMQ_USER \
-                       --name java --startas $DAEMON -- stop
-               if running; then
-                       force_stop
-               fi
-               if running; then
-                       log_progress_msg "(failed)"
-               else
-                       log_progress_msg "(stopped)"
-               fi
+
+               stop_server "$INSTANCE"
        done
 }
 
@@ -182,6 +191,46 @@ force_stop() {
 
 
 case "$1" in
+  console)
+       INSTANCE=$2
+       if [ ! -z $INSTANCE ]; then
+               log_daemon_msg "Starting with Console $DESC " "$INSTANCE"
+               if [ -r 
"${ACTIVEMQ_INSTANCES_ENABLED}/${INSTANCE}/activemq.xml" ]; then
+                       ACTIVEMQ_PIDFILE="/var/run/activemq/$INSTANCE.pid"
+                       
ACTIVEMQ_CONFIG_DIR="$ACTIVEMQ_INSTANCES_ENABLED/$INSTANCE"
+
+                       if [ -f $ACTIVEMQ_PIDFILE ]; then
+                               stop_server "$INSTANCE"
+                       fi
+
+                       export INSTANCE
+                       export ACTIVEMQ_USER
+                       export ACTIVEMQ_PIDFILE
+                       export ACTIVEMQ_HOME=/usr/share/activemq
+                       export ACTIVEMQ_CONFIG_DIR
+
+                       # Import global configuration
+                       . /usr/share/activemq/activemq-options
+                       # Import per instance configuration
+                       [ -r "${ACTIVEMQ_CONFIG_DIR}/options" ] && . 
${ACTIVEMQ_CONFIG_DIR}/options
+
+                       ACTIVEMQ_ARGS=$(echo $ACTIVEMQ_ARGS | sed 
's/start/console/')
+
+                       start-stop-daemon --start --pidfile $ACTIVEMQ_PIDFILE \
+                               --chuid $ACTIVEMQ_USER \
+                               --name java --startas $DAEMON -- $ACTIVEMQ_ARGS
+               else
+                       echo "File 
${ACTIVEMQ_INSTANCES_ENABLED}/${BROKER}/activemq.xml not found."
+                       exit 1
+               fi
+       else
+               echo "Usage: $0 console foo"
+               echo "This will start instance foo in foreground useful for 
debugging purposes."
+               exit 1
+       fi
+
+        log_end_msg 0
+       ;;
   start)
         log_daemon_msg "Starting $DESC " "$NAME"
        start_servers
@@ -220,7 +269,7 @@ case "$1" in
         log_warning_msg "cannot re-read the config file (use restart)."
         ;;
   *)
-        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
+        echo "Usage: $SCRIPTNAME 
{start|stop|restart|force-reload|status|console}" >&2
         exit 1
         ;;
 esac
diff --git a/debian/changelog b/debian/changelog
index 7c337aa..f97e88a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+activemq (5.5.0+dfsg-4) unstable; urgency=low
+
+  * d/activemq.init: Merge change proposed by Jonas Genannt to allow
+    console startup, useful for debugging purposes. (Closes: #645241).
+
+ -- Damien Raude-Morvan <draz...@debian.org>  Wed, 26 Oct 2011 21:13:20 +0200
+
 activemq (5.5.0+dfsg-3) unstable; urgency=low
 
   * d/control: Wrap-and-sort Build-Depends.

-- 
Debian packaging for activemq

_______________________________________________
pkg-java-commits mailing list
pkg-java-comm...@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

Reply via email to