[ 
https://issues.apache.org/jira/browse/AMQ-6279?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alexandar Zikic updated AMQ-6279:
---------------------------------
    Description: 
The init-script activemq fails to correcty parse the name of the instance it 
was run for.

Example:
* activemq instance is setup with name _activemq-instance-E0_
* init script is /etc/init.d/activemq-instance-E0 (symlink to 
/opt/apache-activemq-5.13.2/bin/activemq)
* adding the init-script to chkconfig results in the symlink 
/etc/rc3.d/S50activemq-instance-E0

Running the init-script by hand results in a normal startup:
{noformat}
[root@localhost init.d]# /etc/init.d/activemq-instance-E0 start
INFO: Using alternative activemq configuration files: 
/etc/default/activemq-instance-E0 /root/.activemqrc-instance-E0

INFO: Loading '/etc/default/activemq-instance-E0'
INFO: Using java '/usr/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and 
log4j.properties to get details
INFO: changing to user 'myuser' to invoke java
INFO: pidfile created : 
'/var/apphome/MYAPP/activemq-instance-E0/data/activemq.pid' (pid '1836')
[root@localhost init.d]# ps aux|grep 1836
myuser     1836 43.0 58.3 3062960 292968 ?      Sl   16:02   0:05 /usr/bin/java 
-Xms1G -Xmx2G -Djava.util.logging.config.file=logging.properties 
-Djava.security.auth.login.config=/opt/apache-activemq-5.13.2//conf/login.config
 -Dtransport.port=9101 -Djetty.port=19119 -Dactivemq.sharedfs=/sharedFS/MYAPP_ 
-Dcom.sun.management.jmxremote -Djava.awt.headless=true 
-Djava.io.tmpdir=/var/apphome/MYAPP/activemq-instance-E0/tmp 
-Dactivemq.classpath=/var/apphome/MYAPP/activemq-instance-E0/conf:/opt/apache-activemq-5.13.2//../lib/:
 -Dactivemq.home=/opt/apache-activemq-5.13.2/ 
-Dactivemq.base=/var/apphome/MYAPP/activemq-instance-E0 
-Dactivemq.conf=/var/apphome/MYAPP/activemq-instance-E0/conf 
-Dactivemq.data=/var/apphome/MYAPP/activemq-instance-E0/data -jar 
/opt/apache-activemq-5.13.2//bin/activemq.jar start
root      1872  0.0  0.1 103304   884 pts/0    S+   16:02   0:00 grep 1836
{noformat}

When run by the init system:

{noformat:title=Excerpt from /var/log/boot.log}
INFO: Using alternative activemq configuration files: 
/etc/default/activemq-instance-S50activemq-instance-E0 
/.activemqrc-instance-S50activemq-instance-E0
INFO: Using default configuration
      Configurations are loaded in the following order: 
/etc/default/activemq-instance-S50activemq-instance-E0 
/.activemqrc-instance-S50activemq-instance-E0

INFO: Using java '/usr/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and 
log4j.properties to get details
INFO: pidfile created : '/opt/apache-activemq-5.13.2//data/activemq.pid' (pid 
'1296')
{noformat}

The sed invocation used to extract the instance name from the init-scripts 
filename does no longer work in this case.

{code:title=activemq snippet, the allocation of INST is the problem here}
# CONFIGURATION
# For using instances
if ( basename $0 | grep "activemq-instance-" > /dev/null);then
  INST="`basename $0|sed 's/^activemq-instance-//;s/\.sh$//'`"
  ACTIVEMQ_CONFIGS="/etc/default/activemq-instance-${INST} 
$HOME/.activemqrc-instance-${INST}"
  echo "INFO: Using alternative activemq configuration files: $ACTIVEMQ_CONFIGS"
else
  ACTIVEMQ_CONFIGS="/etc/default/activemq $HOME/.activemqrc 
$ACTIVEMQ_HOME/bin/env"
fi
{code}

A simple wildcard in the sed regxp does fix the issue for me
{code}
INST="`basename $0|sed 's/^.*activemq-instance-//;s/\.sh$//'`"
{code}

  was:
The init-script activemq fails to correcty parse the name of the instance it 
was run for.

Example:
* activemq instance is setup with name _activemq-instance-E0_
* init script is /etc/init.d/activemq-instance-E0 (symlink to 
/opt/apache-activemq-5.13.2/bin/activemq)
* adding the init-script to chkconfig results in the symlink 
/etc/rc3.d/S50activemq-instance-E0

Running the init-script by hand results in a normal startup:
{noformat}
[root@localhost init.d]# /etc/init.d/activemq-instance-E0 start
INFO: Using alternative activemq configuration files: 
/etc/default/activemq-instance-E0 /root/.activemqrc-instance-E0

INFO: Loading '/etc/default/activemq-instance-E0'
INFO: Using java '/usr/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and 
log4j.properties to get details
INFO: changing to user 'myuser' to invoke java
INFO: pidfile created : 
'/var/apphome/MYAPP/activemq-instance-E0/data/activemq.pid' (pid '1836')
[root@localhost init.d]# ps aux|grep 1836
myuser     1836 43.0 58.3 3062960 292968 ?      Sl   16:02   0:05 /usr/bin/java 
-Xms1G -Xmx2G -Djava.util.logging.config.file=logging.properties 
-Djava.security.auth.login.config=/opt/apache-activemq-5.13.2//conf/login.config
 -Dtransport.port=9101 -Djetty.port=19119 -Dactivemq.sharedfs=/sharedFS/MYAPP_ 
-Dcom.sun.management.jmxremote -Djava.awt.headless=true 
-Djava.io.tmpdir=/var/apphome/MYAPP/activemq-instance-E0/tmp 
-Dactivemq.classpath=/var/apphome/MYAPP/activemq-instance-E0/conf:/opt/apache-activemq-5.13.2//../lib/:
 -Dactivemq.home=/opt/apache-activemq-5.13.2/ 
-Dactivemq.base=/var/apphome/MYAPP/activemq-instance-E0 
-Dactivemq.conf=/var/apphome/MYAPP/activemq-instance-E0/conf 
-Dactivemq.data=/var/apphome/MYAPP/activemq-instance-E0/data -jar 
/opt/apache-activemq-5.13.2//bin/activemq.jar start
root      1872  0.0  0.1 103304   884 pts/0    S+   16:02   0:00 grep 1836
{noformat}

When run by the init system:

{noformat:title=Excerpt from /var/log/boot.log}
INFO: Using alternative activemq configuration files: 
/etc/default/activemq-instance-S50activemq-instance-E0 
/.activemqrc-instance-S50activemq-instance-E0
INFO: Using default configuration
      Configurations are loaded in the following order: 
/etc/default/activemq-instance-S50activemq-instance-E0 
/.activemqrc-instance-S50activemq-instance-E0

INFO: Using java '/usr/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and 
log4j.properties to get details
INFO: pidfile created : '/opt/apache-activemq-5.13.2//data/activemq.pid' (pid 
'1296')
{noformat}

The sed invocation used to extract the instance name from init-scripts filename 
does no longer work in this case.

{code:title=activemq snippet, the allocation of INST is the problem here}
# CONFIGURATION
# For using instances
if ( basename $0 | grep "activemq-instance-" > /dev/null);then
  INST="`basename $0|sed 's/^activemq-instance-//;s/\.sh$//'`"
  ACTIVEMQ_CONFIGS="/etc/default/activemq-instance-${INST} 
$HOME/.activemqrc-instance-${INST}"
  echo "INFO: Using alternative activemq configuration files: $ACTIVEMQ_CONFIGS"
else
  ACTIVEMQ_CONFIGS="/etc/default/activemq $HOME/.activemqrc 
$ACTIVEMQ_HOME/bin/env"
fi
{code}

A simple wildcard in the sed regxp does fix the issue for me
{code}
INST="`basename $0|sed 's/^.*activemq-instance-//;s/\.sh$//'`"
{code}


> Init-Script fails to load configuration if run by init-system when using 
> instances
> ----------------------------------------------------------------------------------
>
>                 Key: AMQ-6279
>                 URL: https://issues.apache.org/jira/browse/AMQ-6279
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.13.2
>         Environment: Centos 6.7, OpenJdk 1.7
>            Reporter: Alexandar Zikic
>            Priority: Minor
>
> The init-script activemq fails to correcty parse the name of the instance it 
> was run for.
> Example:
> * activemq instance is setup with name _activemq-instance-E0_
> * init script is /etc/init.d/activemq-instance-E0 (symlink to 
> /opt/apache-activemq-5.13.2/bin/activemq)
> * adding the init-script to chkconfig results in the symlink 
> /etc/rc3.d/S50activemq-instance-E0
> Running the init-script by hand results in a normal startup:
> {noformat}
> [root@localhost init.d]# /etc/init.d/activemq-instance-E0 start
> INFO: Using alternative activemq configuration files: 
> /etc/default/activemq-instance-E0 /root/.activemqrc-instance-E0
> INFO: Loading '/etc/default/activemq-instance-E0'
> INFO: Using java '/usr/bin/java'
> INFO: Starting - inspect logfiles specified in logging.properties and 
> log4j.properties to get details
> INFO: changing to user 'myuser' to invoke java
> INFO: pidfile created : 
> '/var/apphome/MYAPP/activemq-instance-E0/data/activemq.pid' (pid '1836')
> [root@localhost init.d]# ps aux|grep 1836
> myuser     1836 43.0 58.3 3062960 292968 ?      Sl   16:02   0:05 
> /usr/bin/java -Xms1G -Xmx2G 
> -Djava.util.logging.config.file=logging.properties 
> -Djava.security.auth.login.config=/opt/apache-activemq-5.13.2//conf/login.config
>  -Dtransport.port=9101 -Djetty.port=19119 
> -Dactivemq.sharedfs=/sharedFS/MYAPP_ -Dcom.sun.management.jmxremote 
> -Djava.awt.headless=true 
> -Djava.io.tmpdir=/var/apphome/MYAPP/activemq-instance-E0/tmp 
> -Dactivemq.classpath=/var/apphome/MYAPP/activemq-instance-E0/conf:/opt/apache-activemq-5.13.2//../lib/:
>  -Dactivemq.home=/opt/apache-activemq-5.13.2/ 
> -Dactivemq.base=/var/apphome/MYAPP/activemq-instance-E0 
> -Dactivemq.conf=/var/apphome/MYAPP/activemq-instance-E0/conf 
> -Dactivemq.data=/var/apphome/MYAPP/activemq-instance-E0/data -jar 
> /opt/apache-activemq-5.13.2//bin/activemq.jar start
> root      1872  0.0  0.1 103304   884 pts/0    S+   16:02   0:00 grep 1836
> {noformat}
> When run by the init system:
> {noformat:title=Excerpt from /var/log/boot.log}
> INFO: Using alternative activemq configuration files: 
> /etc/default/activemq-instance-S50activemq-instance-E0 
> /.activemqrc-instance-S50activemq-instance-E0
> INFO: Using default configuration
>       Configurations are loaded in the following order: 
> /etc/default/activemq-instance-S50activemq-instance-E0 
> /.activemqrc-instance-S50activemq-instance-E0
> INFO: Using java '/usr/bin/java'
> INFO: Starting - inspect logfiles specified in logging.properties and 
> log4j.properties to get details
> INFO: pidfile created : '/opt/apache-activemq-5.13.2//data/activemq.pid' (pid 
> '1296')
> {noformat}
> The sed invocation used to extract the instance name from the init-scripts 
> filename does no longer work in this case.
> {code:title=activemq snippet, the allocation of INST is the problem here}
> # CONFIGURATION
> # For using instances
> if ( basename $0 | grep "activemq-instance-" > /dev/null);then
>   INST="`basename $0|sed 's/^activemq-instance-//;s/\.sh$//'`"
>   ACTIVEMQ_CONFIGS="/etc/default/activemq-instance-${INST} 
> $HOME/.activemqrc-instance-${INST}"
>   echo "INFO: Using alternative activemq configuration files: 
> $ACTIVEMQ_CONFIGS"
> else
>   ACTIVEMQ_CONFIGS="/etc/default/activemq $HOME/.activemqrc 
> $ACTIVEMQ_HOME/bin/env"
> fi
> {code}
> A simple wildcard in the sed regxp does fix the issue for me
> {code}
> INST="`basename $0|sed 's/^.*activemq-instance-//;s/\.sh$//'`"
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to