Package: activemq Version: 5.5.0+dfsg-3 Severity: wishlist -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
Hello, I have added an console startup feature to the init script of ActiveMQ. This patch allows you to start any ActiveMQ instance in foreground - if the instance is running with init script will stop it before. It's very useful for debugging an instance. Feel free to include it. Thanks, Jonas -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQIcBAEBCAAGBQJOlzJ4AAoJEPBM7/YBbP/Qj4YP/094FKMe3Nd3kdDQIdwiADWR 9INokLT8I+J3+zYkxQfaR2AO0AGktA66G2EwBDwXUrK/nzOXF5Xdmc0muXrljNKQ /3m22GAuUtF/K0kU+0jcDt3V+YDEhEXhA3uoi+OFHE74ebXPZ66IGKbI7cRVch7M qTDoDpc+8weR3udcElGAfqeyZj7psj7UrEjVaFXUDraXQXqrEqs5/qFPVcsXOMHu 5JJLn3v6I9m2ZOzv6txkANpB61ZKB5cB5//RAm1YVXLc0DiSFbZHhW2TqyFyd2RP 3qAyHqyYNHYGJjC115cp3FKSwRDY8EcpWhvkdkzEWIcx6j5X7s6KJ4CFQox7jeqQ 4vdStVhv1Arqokl9YfGesjOjpjxcog5dTdfKxl0sJY3Uwt7WkPHsjZFy2gcUO9wT Tj2Em7K4cpoPBGQrT3uo/ARobPLpubRSV4UHl7CDl4Fr4AZ3TjcQsBC2XnnPOfVa xB+WevjbtvRIPfeFQdMOxELwA0HY373DP8Pf69s+dUUoCeb946JRjU8rJ16Yrvec SnV89NcT0tnlkkUMf+t6xFrfhTp2E3mzzniazGMVcmrFF25Zaip2xOihpry0ryza PaES2X8PCa2IOLqvlfWQgUb+fll9dYJ9mbeb1lNYoTgn0sqH9NZaz10tgoJnvauj kYqiF2fTfbAZUmrir99D =S2kw -----END PGP SIGNATURE-----
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
__ This is the maintainer address of Debian's Java team <http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-maintainers>. Please use debian-j...@lists.debian.org for discussions and questions.