On 4/8/11 11:07 AM, Alexey Loubyansky wrote:
I've pushed the following
./jboss-admin.sh commands=cmd1,cmd2,cmd3
If somebody can suggest a better syntax, please, do.
This is merged into upstream. Folks, please play and give feeback.
I tried to use "command=:shutdown" instead of "commands" and it
didn't
complain but didn't magically execute my command. :-) If it can't
understand something on the cmd line it should complain.
';' as a separator can't work because bash uses it as a
command separator.
If you want to execute a command with arguments, you have to use quotes
like this
./jboss-admin.sh commands="connect,'ls -l',quit"
Actually, explicit 'quit' is not necessary. Which is also up for
discussion, should it be necessary?
I see the core use case for "commands=xx" as doing a quick task without
having to worry about stdin. Requiring an explicit 'quit' makes that
core use case more difficult.
If the user wants the process to stay alive and read commands via stdin,
then they must have some way of feeding those commands to stdin. So it's
not much of a burden to say the first command must come via stdin.
The following will be an equivalent to the above
./jboss-admin.sh --connect commands="'ls -l'"
Alexey
On 04/07/2011 09:54 PM, Alexey Loubyansky wrote:
> On 04/06/2011 11:00 PM, Brian Stansberry wrote:
>> The management API exposes a command "shutdown" on the root resource
for
>> a standalone server.
>>
>> Here's a hack that worked for me for executing that from the CLI:
>>
>> pingguo:bin bstansberry$ (echo :shutdown; echo quit) | ./jboss-admin.sh
>> --connect controller=localhost:9999
>> =========================================================================
>>
>> JBoss Admin Command-line Interface
>>
>> JBOSS_HOME: .....
>>
>> JAVA: .....
>>
>> JAVA_OPTS:
>>
>> =========================================================================
>>
>> Connected to localhost:9999
>> [localhost:9999 /] :shutdown
>> Communication error: java.util.concurrent.ExecutionException:
>> java.io.EOFException: Connection closed
>> [localhost:9999 /] quit
>> Closed connection to localhost:9999
>> pingguo:bin bstansberry$
>>
>>
>> The "--connect" argument passed to jboss-admin.sh tells it to connect
>> when it starts, without a separate command after it starts. The
>> "controller=localhost:9999" bit tells it how to connect. In this case
>> it's unnecessary; since localhost:9999 is the default.
>>
>> Once I merge JBAS-9839 there will be a --file=xxx.txt option whereby
>> multiple commands can be read from a file.
>>
>> The hack I did with (echo :shutdown; echo quit) was to get the CLI to
>> read two commands from stdin: the server shutdown command and an
>> instruction that the CLI itself should exit. I'm sure there are better
>> ways to do that.
>>
>> Alexey, WDYT about something like this:
>>
>> ./jboss-admin.sh --connect --exec=:shutdown
>>
>> Basically --exec means "execute one command and exit".
>
> I had the same thought and actually created a jira issue for that. At
> the moment I have
>
> ./jboss-admin.sh --connect file=file_path
>
> where file_path points to the file with commands to execute and quit
> after the last one.
>
>
https://issues.jboss.org/browse/JBAS-9270
>
> The actual syntax/argument names can/should be discussed. I can't say
> I'm completely comfortable with the current one.
>
> Alexey
>
>>
>> On 4/6/11 3:29 AM, Jaikiran Pai wrote:
>>> Now that the JIRA has been resolved, what's the script/command to
>>> shutdown the server? I'm configuring some hudson jobs which will need
>>> this shutdown command to start/stop the server.
>>>
>>> -Jaikiran
>>> On Tuesday 22 March 2011 05:49 AM, Jason T. Greene wrote:
>>>> Looks like we are missing an operation for standalone mode:
>>>>
https://issues.jboss.org/browse/JBAS-9104
>>>>
>>>> I'll get that to you ASAP.
>>>>
>>>> So right now the only reliable way is to send it a SIGINT or SIGTERM.
>>>>
>>>> On 3/21/11 6:50 PM, Scott Stark wrote:
>>>>> For the current usage I need to be able to shutdown a standalone
node,
>>>>> so we could just add shutdown option to the standalone.sh, or have
the
>>>>> shutdown.sh. What is the syntax for shutting down a standalone
instance
>>>>> via the CLI?
>>>>>
>>>>> On 3/21/11 4:38 PM, Jason Greene wrote:
>>>>>> The intention was that we would just use the CLI to do that.
Although currently we do t have the convenience commands yet, the CLI just executes
management operations. We could make a shutdown.sh that calls the CLI with the convenience
command, if you think people will expect it. It would not work for domain mode though.
>>>>>>
>>>>>> Sent from my iPad
>>>>>>
>>>>>> On Mar 21, 2011, at 6:29 PM, Scott Stark<sstark(a)redhat.com>
wrote:
>>>>>>
>>>>>>> What is the as7 equivalent of the shutdown.sh command?
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> jboss-as7-dev mailing list
>>>>>>> jboss-as7-dev(a)lists.jboss.org
>>>>>>>
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>>>>>
>>>>> _______________________________________________
>>>>> jboss-as7-dev mailing list
>>>>> jboss-as7-dev(a)lists.jboss.org
>>>>>
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>>>>
>>>>
>>>
>>> _______________________________________________
>>> jboss-as7-dev mailing list
>>> jboss-as7-dev(a)lists.jboss.org
>>>
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>>
>>
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
_______________________________________________
jboss-as7-dev mailing list
jboss-as7-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
--
Brian Stansberry
Principal Software Engineer
JBoss by Red Hat