You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by Dejan Bosanac <de...@nighttale.net> on 2015/07/02 13:14:29 UTC

Re: Please review: Unix Init Script Improvements - strange options "export" and "create"

Hi Marc,

these commands are not deprecated, they are documented (partially) here
http://activemq.apache.org/unix-shell-script.html

As far as I can see, export is still work in progress, it should work like

bin/activemq export --file=archive.tgz

Create command is often used and it can be used like

bin/activemq create test-broker

BTW. While you at it, you might wanna take a peak at this PR
https://github.com/apache/activemq/pull/109 and maybe close your original
PR for improvements.



Regards
--
Dejan Bosanac
about.me/dejanb

On Tue, Jun 30, 2015 at 9:04 AM, Marc Schöchlin <ms...@256bit.org> wrote:

>  Hi,
>
> i had a look for the "export" feature of activemq.
>
> The documentation and the wiki search does not provide information about
> usage of this feature - the only information is : "Exports a stopped
> brokers data files to an archive file".
> Invoking this functionality raised strage error messages:
>
> $ ./activemq export
> INFO: Loading '/home/mschoechlin/myroot/apache-activemq-5.11.1//bin/env'
> INFO: Using java '/home/mschoechlin/myroot/java8/bin/java'
> Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
> Java Runtime: Oracle Corporation 1.8.0_45
> /home/mschoechlin/myroot/jdk1.8.0_45/jre
>   Heap sizes: current=62976k  free=60999k  max=932352k
>     JVM args: -javaagent:/usr/share/java/jayatanaag.jar -Xms64M -Xmx1G
> -Djava.util.logging.config.file=logging.properties
> -Djava.security.auth.login.config=/home/mschoechlin/myroot/apache-activemq-5.11.1//conf/login.config
> -Dactivemq.classpath=/home/mschoechlin/myroot/apache-activemq-5.11.1//conf:/home/mschoechlin/myroot/apache-activemq-5.11.1//../lib/
> -Dactivemq.home=/home/mschoechlin/myroot/apache-activemq-5.11.1/
> -Dactivemq.base=/home/mschoechlin/myroot/apache-activemq-5.11.1/
> -Dactivemq.conf=/home/mschoechlin/myroot/apache-activemq-5.11.1//conf
> -Dactivemq.data=/home/mschoechlin/myroot/apache-activemq-5.11.1//data
> Extensions classpath:
>
> [/home/mschoechlin/myroot/apache-activemq-5.11.1/lib,/home/mschoechlin/myroot/apache-activemq-5.11.1/lib/camel,/home/mschoechlin/myroot/apache-activemq-5.11.1/lib/optional,/home/mschoechlin/myroot/apache-activemq-5.11.1/lib/web,/home/mschoechlin/myroot/apache-activemq-5.11.1/lib/extra]
> ACTIVEMQ_HOME: /home/mschoechlin/myroot/apache-activemq-5.11.1
> ACTIVEMQ_BASE: /home/mschoechlin/myroot/apache-activemq-5.11.1
> ACTIVEMQ_CONF: /home/mschoechlin/myroot/apache-activemq-5.11.1/conf
> ACTIVEMQ_DATA: /home/mschoechlin/myroot/apache-activemq-5.11.1/data
> ERROR: java.lang.Exception: *required --file option missing*
> java.lang.Exception: required --file option missing
>     at
> org.apache.activemq.console.command.store.StoreExporter.execute(StoreExporter.java:80)
>     at
> org.apache.activemq.console.command.StoreExportCommand.execute(StoreExportCommand.java:55)
>     at
> org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:150)
>     at
> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
>     at
> org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke(Method.java:497)
>     at org.apache.activemq.console.Main.runTaskClass(Main.java:262)
>     at org.apache.activemq.console.Main.main(Main.java:115)
>
> $ ./activemq export *--file /tmp/foobar*
> INFO: Loading '/home/mschoechlin/myroot/apache-activemq-5.11.1//bin/env'
> INFO: Using java '/home/mschoechlin/myroot/java8/bin/java'
> Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
> Java Runtime: Oracle Corporation 1.8.0_45
> /home/mschoechlin/myroot/jdk1.8.0_45/jre
>   Heap sizes: current=62976k  free=60999k  max=932352k
>     JVM args: -javaagent:/usr/share/java/jayatanaag.jar -Xms64M -Xmx1G
> -Djava.util.logging.config.file=logging.properties
> -Djava.security.auth.login.config=/home/mschoechlin/myroot/apache-activemq-5.11.1//conf/login.config
> -Dactivemq.classpath=/home/mschoechlin/myroot/apache-activemq-5.11.1//conf:/home/mschoechlin/myroot/apache-activemq-5.11.1//../lib/
> -Dactivemq.home=/home/mschoechlin/myroot/apache-activemq-5.11.1/
> -Dactivemq.base=/home/mschoechlin/myroot/apache-activemq-5.11.1/
> -Dactivemq.conf=/home/mschoechlin/myroot/apache-activemq-5.11.1//conf
> -Dactivemq.data=/home/mschoechlin/myroot/apache-activemq-5.11.1//data
> Extensions classpath:
>
> [/home/mschoechlin/myroot/apache-activemq-5.11.1/lib,/home/mschoechlin/myroot/apache-activemq-5.11.1/lib/camel,/home/mschoechlin/myroot/apache-activemq-5.11.1/lib/optional,/home/mschoechlin/myroot/apache-activemq-5.11.1/lib/web,/home/mschoechlin/myroot/apache-activemq-5.11.1/lib/extra]
> ACTIVEMQ_HOME: /home/mschoechlin/myroot/apache-activemq-5.11.1
> ACTIVEMQ_BASE: /home/mschoechlin/myroot/apache-activemq-5.11.1
> ACTIVEMQ_CONF: /home/mschoechlin/myroot/apache-activemq-5.11.1/conf
> ACTIVEMQ_DATA: /home/mschoechlin/myroot/apache-activemq-5.11.1/data
> ERROR | Could not set property file on
> org.apache.activemq.console.command.store.StoreExporter@18bf3d14
> java.lang.IllegalArgumentException: Cannot convert from class
> java.lang.String to class java.io.File with value true
>     at
> org.apache.activemq.util.IntrospectionSupport.convert(IntrospectionSupport.java:219)[activemq-client-5.11.1.jar:5.11.1]
>     at
> org.apache.activemq.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:178)[activemq-client-5.11.1.jar:5.11.1]
>     at
> org.apache.activemq.console.command.store.amq.CommandLineSupport.setOptions(CommandLineSupport.java:81)[activemq-console-5.11.1.jar:5.11.1]
>     at
> org.apache.activemq.console.command.StoreExportCommand.execute(StoreExportCommand.java:51)[activemq-console-5.11.1.jar:5.11.1]
>     at
> org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:150)[activemq-console-5.11.1.jar:5.11.1]
>     at
> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)[activemq-console-5.11.1.jar:5.11.1]
>     at
> org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)[activemq-console-5.11.1.jar:5.11.1]
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)[:1.8.0_45]
>     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_45]
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_45]
>     at java.lang.reflect.Method.invoke(Method.java:497)[:1.8.0_45]
>     at
> org.apache.activemq.console.Main.runTaskClass(Main.java:262)[activemq.jar:5.11.1]
>     at
> org.apache.activemq.console.Main.main(Main.java:115)[activemq.jar:5.11.1]
> ERROR: java.lang.Exception: Unexpected arguments: [--file, /tmp/foobar]
> java.lang.Exception: Unexpected arguments: [--file, /tmp/foobar]
>     at
> org.apache.activemq.console.command.StoreExportCommand.execute(StoreExportCommand.java:53)
>     at
> org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:150)
>     at
> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
>     at
> org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke(Method.java:497)
>     at org.apache.activemq.console.Main.runTaskClass(Main.java:262)
>     at org.apache.activemq.console.Main.main(Main.java:115)
>
>
> What is the detailed usage scenario for this feature and how can i use it?
> How can i import the file?
>
> Same thing also for the "create" option.
>
> Are these functions deprecated and should be removed?
>
> Best regards,
> Marc Schoechlin
>
> Am 29.06.2015 um 23:27 schrieb Marc Schöchlin:
>
> Hello developers,
>
> i improved the documentation and the implementation of the unix init
> script.
>
> *Documentation:*
> (solves https://issues.apache.org/jira/browse/AMQ-5448)
> https://cwiki.apache.org/confluence/display/ACTIVEMQ/Unix+Shell+Script
>
> http://activemq.apache.org/getting-started.html#GettingStarted-UnixBinaryInstallation
>
> *Shell script improvements:*
> (solves https://issues.apache.org/jira/browse/AMQ-5378)
>
> The script should now run on various unix platforms (linux, solaris,
> macos) without problems.
> I added a small testsuite which helps to find problems on unix platforms.
> See:
> https://cwiki.apache.org/confluence/display/ACTIVEMQ/Unix+Shell+Script
>
> The changes were committed on the master branch.
> Feedback, bug reports and improvement ideas are very welcome :-)
>
> Regards
> Marc
>
> ------------------------------
>
> commit 06202097a28b21efb9864d4d75a40cab7675bf98
> Merge: 3870aa9 f3fc589
> Author: Marc Schoechlin <ma...@breuninger.de>
> <ma...@breuninger.de>
> Date:   Mon Jun 29 22:01:14 2015 +0200
>
>     Merge branch 'master' of
> https://git-wip-us.apache.org/repos/asf/activemq
>
> commit 3870aa94473b2253e7a38e5897187d1049d60059
> Merge: aeb93e4 002ade7
> Author: Marc Schoechlin <ma...@breuninger.de>
> <ma...@breuninger.de>
> Date:   Mon Jun 29 08:34:50 2015 +0200
>
>     Resolved merge conflict
>
> commit aeb93e4a2455dff169da302fb19f7fa55d21a0c0
> Author: Marc Schoechlin <ma...@breuninger.de>
> <ma...@breuninger.de>
> Date:   Sat Jun 6 17:02:31 2015 +0200
>
>     improve stability
>
>     - added more reliable quoting
>     - improved reliability of stopping
>     - improved management of concurrent stop processes
>     - added a "kill" option which terminates the daemon in a rude way
>
> commit a767bda603119387af8e8ce06af268470fe33c3a
> Author: Marc Schoechlin <ma...@breuninger.de>
> <ma...@breuninger.de>
> Date:   Sun Jan 4 12:16:25 2015 +0100
>
>     Memory configuration
>
>     Reduce the default memory minimal overhead of activemq from 1G to 64M
> to
>     ensure that activemq does not revoke to work in small environments.
>     If a larger process heap than 64M is needed the jvm grows up to 1GB.
>
>     Conflicts:
>         assembly/src/release/bin/env
>
> commit 07920b25343f6e66aeb9d46bcbd9be6a73ba5f8e
> Author: Marc Schoechlin <ma...@breuninger.de>
> <ma...@breuninger.de>
> Date:   Sun Jan 4 12:21:44 2015 +0100
>
>     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
>
> commit 250bc9ea95d35307532332bd051e9c44191bea70
> Author: Marc Schoechlin <ma...@breuninger.de>
> <ma...@breuninger.de>
> Date:   Sun Jan 4 12:41:34 2015 +0100
>
>     stop behavior
>
>     fix bug caused by a uncomplete change which renames the pidfile for a
>     running shutdown task
>
> commit 0eb45b434d943e274b8a8dabc1e9b9247f18a1bb
> Author: Marc Schoechlin <ma...@breuninger.de>
> <ma...@breuninger.de>
> Date:   Sun Jan 4 12:44:07 2015 +0100
>
>     create a pidfile for a console run
>
>     this adds a pidfile which contains the pid of the running shellscript
> if
>     activemq is run by "console". This prevents problems if someone tries
> to
>     to use i.e. the start/stop options while some is debugging activemq in
>     foreground mode.
>
> commit 02a94143dbda9cd2413d972d21f28a0f4024c15c
> Author: Marc Schoechlin <ma...@breuninger.de>
> <ma...@breuninger.de>
> Date:   Sun Jan 4 12:50:32 2015 +0100
>
>     check status of running status
>
>     This adds a better output for some tasks if the broker is not running.
>     The user gets the information that the broker is currently not running.
>     Users are confused if they see a java stacktrace on invoking commands -
>     often they do not read error output in detail.
>     This change respects that the script can also be used to contact remote
>     brokers - if ACTIVEMQ_QUEUEMANAGERURL is defined you get the regular
>     stacktrace, because the script cannot know about the state if a remote
>     broker.
>     In >98% of all cases this script controls local instances - we should
>     help the common user!
>
> commit dd647f98a50b30427ca8160245fcff437cbd0080
> Author: Marc Schoechlin <ma...@breuninger.de>
> <ma...@breuninger.de>
> Date:   Sun Jan 4 12:59:31 2015 +0100
>
>     provide the real exitcodes
>
>     provide the exitcode of the task to the user
>
> commit ea5f4de399c56c9aed3bb39ba9fe63b8ab856122
> Author: Marc Schoechlin <ma...@breuninger.de>
> <ma...@breuninger.de>
> Date:   Sun Feb 15 13:04:27 2015 +0100
>
>     Minor improvment
>
>     Conflicts:
>         assembly/src/test/scripts/init-script-testsuite
>
> commit ce3939b11fa4639f65518e1bc2ded26583d2651b
> Author: Marc Schoechlin <ma...@breuninger.de>
> <ma...@breuninger.de>
> Date:   Mon Feb 23 17:49:04 2015 +0100
>
>     Added help text to give the user a hint how to configure activemq
>
>     Conflicts:
>         assembly/src/release/bin/env
>
> commit e52b7dc368572895cbd7b2b48eb8c3573e767c04
> Author: Marc Schoechlin <ma...@breuninger.de>
> <ma...@breuninger.de>
> Date:   Tue Apr 21 05:58:31 2015 +0200
>
>     AMQ-5733: return exitcode 0 if stop was sucessful
>
>     according to
> http://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
>     the exitcode should be 0, although this is a abnormal termination way
>
>
>
>
> --
> GPG encryption available: 0x670DCBEC/pool.sks-keyservers.net
> (https://www.256bit.org/keys/mschoechlin.pub.asc)
>
>
> --
> GPG encryption available: 0x670DCBEC/pool.sks-keyservers.net
> (https://www.256bit.org/keys/mschoechlin.pub.asc)
>
>

Re: Please review: Unix Init Script Improvements - strange options "export" and "create"

Posted by Marc Schöchlin <ms...@256bit.org>.

Am 06.07.2015 um 18:13 schrieb Dejan Bosanac:
> bin/activemq export --file=archive.tgz
>> What is the usecase for this feature?
>> Is there als a "import"
>>
> There’s an import in Apollo broker and I assume we’ll create it for Artemis
> to ease the migration.
>
Ah great.


> I’m not sure about this. It works here (just checked). Please raise a Jira
> for it.
>
See https://issues.apache.org/jira/browse/AMQ-5902

Can somebody create a component named "Unix-Script" in the ActiveMQ Jira?
(Probably with my id "scoopex" as component maintainer)
>
>>> Create command is often used and it can be used like
>>>
>>> bin/activemq create test-brokeres
>> Ah ok. What are the known usecases?
>>
>> The activemq init script provides also the functionality to create and
>> run multiple instances on the same machine.
>> This mechanism also provides a independent script environment
>> configuration.
>>
> It allows you to use different broker instances using the same binaries. So
> ACTIVEMQ_HOME is the same, but ACTIVEMQ_BASE is different. You can have one
> installation of the broker and then run multiple instances with different
> configuration. Try it out, it copies bin/ and conf/ directories and you
> don’t need to change any environment variables or use init.d.
>
>
>>
>> https://cwiki.apache.org/confluence/display/ACTIVEMQ/Unix+Shell+Script#UnixShellScript-Runningmultipleinstances
>>> BTW. While you at it, you might wanna take a peak at this PR
>>> https://github.com/apache/activemq/pull/109 and maybe close your
>> original
>>> PR for improvements.
>>>
>> The described problem happens because the file "env" has exec
>> permissions and the activemq bin folder is part of the PATH variable?
>> The "env" file does not need exec permissions, but this might be a
>> typical problem.
>>
> If changing permissions on env would solve it, I think it should be the
> best approach (instead of renaming or moving it).
That will solve the problem.
I fixed that at src/main/descriptors/unix-bin.xml.

See commit :

$ git show 167c510
commit 167c510331692bfa2648724d16330d49ec8dd0ae
Author: Marc Schoechlin <ma...@breuninger.de>
Date:   Sat Jul 25 17:22:10 2015 +0200

    changed permissions of "env" file
   
    The previous permission of the  <activemq-install-dir>/bin/env file
    (755) caused some problems on systems where the
    <activemq-install-dir>/bin/ directory is part of the PATH variable.
    The executable "env" is also available of all common unix platforms.
    If <activemq-install-dir>/bin/ has precedence in the PATH environment
    variable this causes lots of unexpected problems.
    In future it would be a good idea to relocate the file to the
    <activemq-install-dir>/conf directory.

diff --git a/assembly/src/main/descriptors/unix-bin.xml b/assembly/src/main/descriptors/unix-bin.xml
index a1e4d38..592d75e 100644
--- a/assembly/src/main/descriptors/unix-bin.xml
+++ b/assembly/src/main/descriptors/unix-bin.xml
@@ -96,7 +96,6 @@
       <outputDirectory>/</outputDirectory>
       <includes>
         <include>bin/activemq</include>
-        <include>bin/env</include>
         <include>bin/diag</include>
         <include>bin/activemq-admin</include>
         <include>bin/macosx/activemq</include>
@@ -107,6 +106,19 @@
       <lineEnding>unix</lineEnding>
     </fileSet>
 
+    <!-- Copy over the unix-script configuration file that need unix line endings and also chmod to 644 -->
+    <fileSet>
+      <directory>src/release</directory>
+      <outputDirectory>/</outputDirectory>
+      <includes>
+        <include>bin/env</include>
+      </includes>
+      <directoryMode>0755</directoryMode>
+      <fileMode>0644</fileMode>
+      <lineEnding>unix</lineEnding>
+    </fileSet>
+
+
     <!-- Copy over example scripts that need unix line endings and also chmod to 755 -->
     <fileSet>
       <directory>src/release</directory>


>
>> Probably we should move the "env" script to conf/env (i hate changing
>> file locations, because creates problems for the users).
>> We should also rename the script "diag" to "activemq-diag" or we should
>> add this functionality to the init script.
>> I think the second possibility might be better - because this also
>> allows access to the script configuration.
>>
> I’d leave it as a separate script as init scripts is complex, so no need to
> add more to it. If we just change permissions on env, we can leave diag as
> is.
I renamed the utility to a non problematic name. Due to the fact that this script is only needed for debug purposes this should not be problematic.
From my point of view i recommend to remove that file.

commit eb8723c1e9f8de350cc8974c0a9fcb1b68caf26e
Author: Marc Schoechlin <ma...@breuninger.de>
Date:   Sat Jul 25 17:43:07 2015 +0200

    renamed bin/diag to bin/activemq-diag
   
    This prevents ambiguities in the unix PATH environment variable.



>
>> I also want to drop the "activemq-admin" script, because the
>> functionality of this script is redundant to the "activemq" script.
>> What do you think?
>>
>>
> I agree, it duplicates functionality and is not maintained properly.
>

Its completely feature redundant. Removed it by the following commit.

Author: Marc Schoechlin <ma...@breuninger.de>
Date:   Sat Jul 25 17:40:28 2015 +0200

    removed activemq-admin
   
    This script provides redundant functionality to "bin/activemq" and its
    broken because it uses the wrong environment configuration.



Regards
Marc

-- 
GPG encryption available: 0x670DCBEC/pool.sks-keyservers.net



Re: Please review: Unix Init Script Improvements - strange options "export" and "create"

Posted by Marc Schöchlin <ms...@256bit.org>.
Hi,


Am 07.07.2015 um 23:51 schrieb artnaseef:
> One thought here.  There's a lot of complexity and functionality in the
> existing scripts.
>
> Perhaps it would make sense to start a new set of smaller scripts that are
> more focused on individual tasks.  If we want to have a master script so the
> command-name is the same across multiple functions, that would be easy
> enough to do.
>
> One concern here is breaking backward compatibility and ease-of-upgrade for
> users.  The 5.11.1 script updates (maybe earlier?) did make at least one
> non-backward-compatible change.
>
> I have a lot of thoughts on the scripts (I was a Unix & C dev longer than
> I've been a Java dev).  Let's chat on IRC if you're interested.
My intend for writing a central script some years ago was:

  * make the script more intelligent
  * provide a single interface for all tasks
  * prevent duplication of shellscript code
  * improve usability from users point of view

I think the current implementation is ok from user-view - but i think the logic is a too complex.
Probably many aspects of the script would be better to be part of the java implementation.....

Regards
Marc


-- 
GPG encryption available: 0x670DCBEC/pool.sks-keyservers.net


Re: Please review: Unix Init Script Improvements - strange options "export" and "create"

Posted by artnaseef <ar...@artnaseef.com>.
One thought here.  There's a lot of complexity and functionality in the
existing scripts.

Perhaps it would make sense to start a new set of smaller scripts that are
more focused on individual tasks.  If we want to have a master script so the
command-name is the same across multiple functions, that would be easy
enough to do.

One concern here is breaking backward compatibility and ease-of-upgrade for
users.  The 5.11.1 script updates (maybe earlier?) did make at least one
non-backward-compatible change.

I have a lot of thoughts on the scripts (I was a Unix & C dev longer than
I've been a Java dev).  Let's chat on IRC if you're interested.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Please-review-Unix-Init-Script-Improvements-tp4698378p4698743.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Re: Please review: Unix Init Script Improvements - strange options "export" and "create"

Posted by Dejan Bosanac <de...@nighttale.net>.
Hi Marc,

(comments inline)

On Sat, Jul 4, 2015 at 8:18 AM, Marc Schöchlin <ms...@256bit.org> wrote:

> Hi Dejan,
>
> Am 02.07.2015 um 13:14 schrieb Dejan Bosanac:
> > Hi Marc,
> >
> > these commands are not deprecated, they are documented (partially) here
> > http://activemq.apache.org/unix-shell-script.html
> >
> > As far as I can see, export is still work in progress, it should work
> like
> >
> > bin/activemq export --file=archive.tgz
>
> What is the usecase for this feature?
> Is there als a "import"
>

There’s an import in Apollo broker and I assume we’ll create it for Artemis
to ease the migration.



>
> Works not on my machine:
>
> $ ./activemq export --file=archive.tgz
> INFO: Loading '/home/mschoechlin/myroot/apache-activemq-5.11.1//bin/env'
> INFO: Using java '/home/mschoechlin/myroot/java8/bin/java'
> Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
> Java Runtime: Oracle Corporation 1.8.0_45
> /home/mschoechlin/myroot/jdk1.8.0_45/jre
>   Heap sizes: current=62976k  free=60999k  max=932352k
>     JVM args: -javaagent:/usr/share/java/jayatanaag.jar -Xms64M -Xmx1G
> -Djava.util.logging.config.file=logging.properties
>
> -Djava.security.auth.login.config=/home/mschoechlin/myroot/apache-activemq-5.11.1//conf/login.config
>
> -Dactivemq.classpath=/home/mschoechlin/myroot/apache-activemq-5.11.1//conf:/home/mschoechlin/myroot/apache-activemq-5.11.1//../lib/
> -Dactivemq.home=/home/mschoechlin/myroot/apache-activemq-5.11.1/
> -Dactivemq.base=/home/mschoechlin/myroot/apache-activemq-5.11.1/
> -Dactivemq.conf=/home/mschoechlin/myroot/apache-activemq-5.11.1//conf
> -Dactivemq.data=/home/mschoechlin/myroot/apache-activemq-5.11.1//data
> Extensions classpath:
>
>
> [/home/mschoechlin/myroot/apache-activemq-5.11.1/lib,/home/mschoechlin/myroot/apache-activemq-5.11.1/lib/camel,/home/mschoechlin/myroot/apache-activemq-5.11.1/lib/optional,/home/mschoechlin/myroot/apache-activemq-5.11.1/lib/web,/home/mschoechlin/myroot/apache-activemq-5.11.1/lib/extra]
> ACTIVEMQ_HOME: /home/mschoechlin/myroot/apache-activemq-5.11.1
> ACTIVEMQ_BASE: /home/mschoechlin/myroot/apache-activemq-5.11.1
> ACTIVEMQ_CONF: /home/mschoechlin/myroot/apache-activemq-5.11.1/conf
> ACTIVEMQ_DATA: /home/mschoechlin/myroot/apache-activemq-5.11.1/data
> ERROR | Could not set property file on
> org.apache.activemq.console.command.store.StoreExporter@18bf3d14
> java.lang.IllegalArgumentException: Cannot convert from class
> java.lang.String to class java.io.File with value archive.tgz
>     at
>
> org.apache.activemq.util.IntrospectionSupport.convert(IntrospectionSupport.java:219)[activemq-client-5.11.1.jar:5.11.1]
>     at
>
> org.apache.activemq.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:178)[activemq-client-5.11.1.jar:5.11.1]
>     at
>
> org.apache.activemq.console.command.store.amq.CommandLineSupport.setOptions(CommandLineSupport.java:81)[activemq-console-5.11.1.jar:5.11.1]
>     at
>
> org.apache.activemq.console.command.StoreExportCommand.execute(StoreExportCommand.java:51)[activemq-console-5.11.1.jar:5.11.1]
>     at
>
> org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:150)[activemq-console-5.11.1.jar:5.11.1]
>     at
>
> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)[activemq-console-5.11.1.jar:5.11.1]
>     at
>
> org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)[activemq-console-5.11.1.jar:5.11.1]
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)[:1.8.0_45]
>     at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_45]
>     at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_45]
>     at java.lang.reflect.Method.invoke(Method.java:497)[:1.8.0_45]
>     at
>
> org.apache.activemq.console.Main.runTaskClass(Main.java:262)[activemq.jar:5.11.1]
>     at
> org.apache.activemq.console.Main.main(Main.java:115)[activemq.jar:5.11.1]
> ERROR: java.lang.Exception: Unexpected arguments: [--file=archive.tgz]
> java.lang.Exception: Unexpected arguments: [--file=archive.tgz]
>     at
>
> org.apache.activemq.console.command.StoreExportCommand.execute(StoreExportCommand.java:53)
>     at
>
> org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:150)
>     at
>
> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
>     at
>
> org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>     at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke(Method.java:497)
>     at org.apache.activemq.console.Main.runTaskClass(Main.java:262)
>     at org.apache.activemq.console.Main.main(Main.java:115)
>

I’m not sure about this. It works here (just checked). Please raise a Jira
for it.



>
> > Create command is often used and it can be used like
> >
> > bin/activemq create test-brokeres
> Ah ok. What are the known usecases?
>
> The activemq init script provides also the functionality to create and
> run multiple instances on the same machine.
> This mechanism also provides a independent script environment
> configuration.
>

It allows you to use different broker instances using the same binaries. So
ACTIVEMQ_HOME is the same, but ACTIVEMQ_BASE is different. You can have one
installation of the broker and then run multiple instances with different
configuration. Try it out, it copies bin/ and conf/ directories and you
don’t need to change any environment variables or use init.d.


>
>
> https://cwiki.apache.org/confluence/display/ACTIVEMQ/Unix+Shell+Script#UnixShellScript-Runningmultipleinstances
> >
> > BTW. While you at it, you might wanna take a peak at this PR
> > https://github.com/apache/activemq/pull/109 and maybe close your
> original
> > PR for improvements.
> >
> The described problem happens because the file "env" has exec
> permissions and the activemq bin folder is part of the PATH variable?
> The "env" file does not need exec permissions, but this might be a
> typical problem.
>

If changing permissions on env would solve it, I think it should be the
best approach (instead of renaming or moving it).


>
> Probably we should move the "env" script to conf/env (i hate changing
> file locations, because creates problems for the users).
> We should also rename the script "diag" to "activemq-diag" or we should
> add this functionality to the init script.
> I think the second possibility might be better - because this also
> allows access to the script configuration.
>

I’d leave it as a separate script as init scripts is complex, so no need to
add more to it. If we just change permissions on env, we can leave diag as
is.


>
> I also want to drop the "activemq-admin" script, because the
> functionality of this script is redundant to the "activemq" script.
> What do you think?
>
>
I agree, it duplicates functionality and is not maintained properly.


> Best regards,
> Marc Schoechlin
>
> --
> GPG encryption available: 0x670DCBEC/pool.sks-keyservers.net
> (https://www.256bit.org/keys/mschoechlin.pub.asc)
>
>
>

Re: Please review: Unix Init Script Improvements - strange options "export" and "create"

Posted by Marc Schöchlin <ms...@256bit.org>.
Hi Dejan,

Am 02.07.2015 um 13:14 schrieb Dejan Bosanac:
> Hi Marc,
>
> these commands are not deprecated, they are documented (partially) here
> http://activemq.apache.org/unix-shell-script.html
>
> As far as I can see, export is still work in progress, it should work like
>
> bin/activemq export --file=archive.tgz

What is the usecase for this feature?
Is there als a "import"

Works not on my machine:

$ ./activemq export --file=archive.tgz
INFO: Loading '/home/mschoechlin/myroot/apache-activemq-5.11.1//bin/env'
INFO: Using java '/home/mschoechlin/myroot/java8/bin/java'
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
Java Runtime: Oracle Corporation 1.8.0_45
/home/mschoechlin/myroot/jdk1.8.0_45/jre
  Heap sizes: current=62976k  free=60999k  max=932352k
    JVM args: -javaagent:/usr/share/java/jayatanaag.jar -Xms64M -Xmx1G
-Djava.util.logging.config.file=logging.properties
-Djava.security.auth.login.config=/home/mschoechlin/myroot/apache-activemq-5.11.1//conf/login.config
-Dactivemq.classpath=/home/mschoechlin/myroot/apache-activemq-5.11.1//conf:/home/mschoechlin/myroot/apache-activemq-5.11.1//../lib/
-Dactivemq.home=/home/mschoechlin/myroot/apache-activemq-5.11.1/
-Dactivemq.base=/home/mschoechlin/myroot/apache-activemq-5.11.1/
-Dactivemq.conf=/home/mschoechlin/myroot/apache-activemq-5.11.1//conf
-Dactivemq.data=/home/mschoechlin/myroot/apache-activemq-5.11.1//data
Extensions classpath:
 
[/home/mschoechlin/myroot/apache-activemq-5.11.1/lib,/home/mschoechlin/myroot/apache-activemq-5.11.1/lib/camel,/home/mschoechlin/myroot/apache-activemq-5.11.1/lib/optional,/home/mschoechlin/myroot/apache-activemq-5.11.1/lib/web,/home/mschoechlin/myroot/apache-activemq-5.11.1/lib/extra]
ACTIVEMQ_HOME: /home/mschoechlin/myroot/apache-activemq-5.11.1
ACTIVEMQ_BASE: /home/mschoechlin/myroot/apache-activemq-5.11.1
ACTIVEMQ_CONF: /home/mschoechlin/myroot/apache-activemq-5.11.1/conf
ACTIVEMQ_DATA: /home/mschoechlin/myroot/apache-activemq-5.11.1/data
ERROR | Could not set property file on
org.apache.activemq.console.command.store.StoreExporter@18bf3d14
java.lang.IllegalArgumentException: Cannot convert from class
java.lang.String to class java.io.File with value archive.tgz
    at
org.apache.activemq.util.IntrospectionSupport.convert(IntrospectionSupport.java:219)[activemq-client-5.11.1.jar:5.11.1]
    at
org.apache.activemq.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:178)[activemq-client-5.11.1.jar:5.11.1]
    at
org.apache.activemq.console.command.store.amq.CommandLineSupport.setOptions(CommandLineSupport.java:81)[activemq-console-5.11.1.jar:5.11.1]
    at
org.apache.activemq.console.command.StoreExportCommand.execute(StoreExportCommand.java:51)[activemq-console-5.11.1.jar:5.11.1]
    at
org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:150)[activemq-console-5.11.1.jar:5.11.1]
    at
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)[activemq-console-5.11.1.jar:5.11.1]
    at
org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)[activemq-console-5.11.1.jar:5.11.1]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)[:1.8.0_45]
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_45]
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_45]
    at java.lang.reflect.Method.invoke(Method.java:497)[:1.8.0_45]
    at
org.apache.activemq.console.Main.runTaskClass(Main.java:262)[activemq.jar:5.11.1]
    at
org.apache.activemq.console.Main.main(Main.java:115)[activemq.jar:5.11.1]
ERROR: java.lang.Exception: Unexpected arguments: [--file=archive.tgz]
java.lang.Exception: Unexpected arguments: [--file=archive.tgz]
    at
org.apache.activemq.console.command.StoreExportCommand.execute(StoreExportCommand.java:53)
    at
org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:150)
    at
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
    at
org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.activemq.console.Main.runTaskClass(Main.java:262)
    at org.apache.activemq.console.Main.main(Main.java:115)

> Create command is often used and it can be used like
>
> bin/activemq create test-brokeres 
Ah ok. What are the known usecases?

The activemq init script provides also the functionality to create and
run multiple instances on the same machine.
This mechanism also provides a independent script environment configuration.

https://cwiki.apache.org/confluence/display/ACTIVEMQ/Unix+Shell+Script#UnixShellScript-Runningmultipleinstances
>
> BTW. While you at it, you might wanna take a peak at this PR
> https://github.com/apache/activemq/pull/109 and maybe close your original
> PR for improvements.
>
The described problem happens because the file "env" has exec
permissions and the activemq bin folder is part of the PATH variable?
The "env" file does not need exec permissions, but this might be a
typical problem.

Probably we should move the "env" script to conf/env (i hate changing
file locations, because creates problems for the users).
We should also rename the script "diag" to "activemq-diag" or we should
add this functionality to the init script.
I think the second possibility might be better - because this also
allows access to the script configuration.

I also want to drop the "activemq-admin" script, because the
functionality of this script is redundant to the "activemq" script.
What do you think?

Best regards,
Marc Schoechlin   

-- 
GPG encryption available: 0x670DCBEC/pool.sks-keyservers.net
(https://www.256bit.org/keys/mschoechlin.pub.asc)