minor stabilisation patches

This commit adds:
- some quoting of variables to prevent problems with unusual paths
- sets some default variables to prevent problems
- adds some function and helptext documentation
This commit is contained in:
Marc Schoechlin 2015-01-04 12:21:44 +01:00
parent 250bc9ea95
commit 07920b2534
1 changed files with 17 additions and 8 deletions

View File

@ -82,7 +82,7 @@ getActiveMQHome(){
echo 'ERROR: unable to find real installtion path fo activemq, you have to define ACTIVEMQ_HOME manually in the config' >&2 echo 'ERROR: unable to find real installtion path fo activemq, you have to define ACTIVEMQ_HOME manually in the config' >&2
exit 1 exit 1
fi fi
echo "$REAL_DIR" echo "$REAL_DIR/"
} }
@ -91,10 +91,12 @@ if [ -z "$ACTIVEMQ_HOME" ] ; then
ACTIVEMQ_HOME="`getActiveMQHome`" ACTIVEMQ_HOME="`getActiveMQHome`"
fi fi
# Active MQ base dir
if [ -z "$ACTIVEMQ_BASE" ] ; then if [ -z "$ACTIVEMQ_BASE" ] ; then
ACTIVEMQ_BASE="$ACTIVEMQ_HOME" ACTIVEMQ_BASE="$ACTIVEMQ_HOME"
fi fi
ACTIVEMQ_CLASSPATH="$ACTIVEMQ_BASE/../lib/"
# Active MQ configuration directory # Active MQ configuration directory
if [ -z "$ACTIVEMQ_CONF" ] ; then if [ -z "$ACTIVEMQ_CONF" ] ; then
@ -178,6 +180,13 @@ if [ "$CONFIG_LOAD" != "yes" ];then
echo echo
fi fi
if [ -z "$ACTIVEMQ_OPTS" ] ; then
ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS_MEMORY -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=$ACTIVEMQ_CONF/login.config"
fi
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
# OS SPECIFIC SUPPORT # OS SPECIFIC SUPPORT
@ -310,7 +319,7 @@ invokeJar(){
echo \"INFO: pidfile created : '$PIDFILE' (pid '\$APID')\";exit \$RET" $DOIT_POSTFIX echo \"INFO: pidfile created : '$PIDFILE' (pid '\$APID')\";exit \$RET" $DOIT_POSTFIX
RET="$?" RET="$?"
elif [ -n "$PIDFILE" ] && [ "$PIDFILE" = "stop" ];then elif [ -n "$PIDFILE" ] && [ "$PIDFILE" = "stop" ];then
PID="`cat ${ACTIVEMQ_PIDFILE}`" PID="`cat "${ACTIVEMQ_PIDFILE}"`"
$EXEC_OPTION $DOIT_PREFIX "\"$JAVACMD\" $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \ $EXEC_OPTION $DOIT_PREFIX "\"$JAVACMD\" $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \
-Dactivemq.classpath=\"${ACTIVEMQ_CLASSPATH}\" \ -Dactivemq.classpath=\"${ACTIVEMQ_CLASSPATH}\" \
-Dactivemq.home=\"${ACTIVEMQ_HOME}\" \ -Dactivemq.home=\"${ACTIVEMQ_HOME}\" \
@ -353,7 +362,7 @@ checkRunning(){
return 2 return 2
fi fi
PID="`cat $ACTIVEMQ_PIDFILE`" PID="`cat $ACTIVEMQ_PIDFILE`"
RET="`ps -p $PID|grep java`" RET="`ps -p "$PID"|grep java`"
if [ -n "$RET" ];then if [ -n "$RET" ];then
return 0; return 0;
else else
@ -429,8 +438,9 @@ invoke_start(){
# Start ActiveMQ in foreground (for debugging) # Start ActiveMQ in foreground (for debugging)
# #
# @RET : 0 => is now started, is already started # @RET : 0 => was started
# !0 => something went wrong # 1 => was already started
# !0 => somthing went wrong
# #
# Note: This function uses globally defined variables # Note: This function uses globally defined variables
# - $ACTIVEMQ_PIDFILE : the name of the pid file # - $ACTIVEMQ_PIDFILE : the name of the pid file
@ -571,7 +581,6 @@ The configuration of this script is read from the following files:
$ACTIVEMQ_CONFIGS $ACTIVEMQ_CONFIGS
This script searches for the files in the listed order and reads the first available file. This script searches for the files in the listed order and reads the first available file.
Modify $ACTIVEMQ_BASE/bin/env or create a copy of that file on a suitable location. Modify $ACTIVEMQ_BASE/bin/env or create a copy of that file on a suitable location.
To use additional configurations for running multiple instances on the same operating system To use additional configurations for running multiple instances on the same operating system
rename or symlink script to a name matching to activemq-instance-<INSTANCENAME>. rename or symlink script to a name matching to activemq-instance-<INSTANCENAME>.
This changes the configuration location to /etc/default/activemq-instance-<INSTANCENAME> and This changes the configuration location to /etc/default/activemq-instance-<INSTANCENAME> and