I found a relevant GShell command called "geronimo/wait-for-server" that
might do the job. The command will check whether all relevent configurations
are fully started. So we can issue something like -
gsh -c "geronimo/wait-for-server -u system -w manager -t 30"
The command exits with code 0 if it finds the server, and code 100 if not.
The unpleasant thing is, same as many GShell command, it will spit out a lot
of constituent and exception information and results in an abnormal JVM
shutdown upon failure. Is this something we want to improve in future?
-Jack
2009/1/14 Ivan <[email protected]>
> No sure whether we have a special command to query the deployed
> applications' status ( I know that we could get those status via JMX). If
> not, I guess that we could extend the Jack's ideas to query all the
> modules' status. We could provide more information about the module more
> than the list module command, such as context path for web applications
> etcThanks for any comment !
>
> 2009/1/13 Jack Cai <[email protected]>
>
> In line below.
>>
>> 2009/1/13 Donald Woods <[email protected]>
>>
>>> How do you propose to handle status while the server is starting or
>>> stopping? How many states would be returned? Would this also be exposed
>>> over JMX?
>>>
>>
>> Currently the kernel only has two status: running or not running. Do we
>> want to add more status in it? But I assume it's not easy to get an accurate
>> "starting/stopping" status.
>>
>>
>>>
>>> How would it really differ from the deployer list-modules command we
>>> already have? Maybe that command needs to return better rc/status/message
>>> when the server is still starting/stopping or not started?
>>
>>
>> The proposed command only deals with the kernel, and will provide
>> meaningful exit code to indicate the status so that other programs can call
>> this script to query server status. The list-modules command deals with the
>> modules and is mostly for human interaction.
>>
>>
>> -Jack
>>
>>
>>>
>>>
>>>
>>> -Donald
>>>
>>>
>>>
>>> Jack Cai wrote:
>>>
>>>> I've seen users asking how to query server status [1], and recently I
>>>> was also asked for the same question by a colleague. So I think maybe it's
>>>> good that Geronimo provide a cross-platform means for querying server
>>>> status. After looking into the code that does server shutdown, I realize
>>>> it's pretty easy to achieve that. All I need to do is to -
>>>>
>>>> 1. Refactor the org.apache.geronimo.deployment.cli.StopServer class to
>>>> something more general, e.g., ServerControl. We can make it to do status
>>>> query or shutdown based on an extra parameter that's passed in, or make it
>>>> a
>>>> super class and create another 2 subclasses to do status query and shutdown
>>>> respectively.
>>>>
>>>> 2. Add a new command to the geronimo.(sh/bat) script, e.g., "status".
>>>> And based on how Step 1 is done, we can either reuse the shutdown.jar
>>>> (probably rename it to control.jar); or create a new status.jar just to do
>>>> status query, and leave the shutdown.jar to do the shutdown.
>>>>
>>>> 3. The code that does the real status query work will be as simply as
>>>> "serverControl.getRunningKernel().isRunning()".
>>>>
>>>> I prefer to reuse the shutdown.jar. If you see no problem with my
>>>> current thinking, I'll go ahead to create a JIRA with a patch.
>>>>
>>>> -Jack
>>>>
>>>> [1]
>>>> http://www.nabble.com/status-from-shell-script-(System-V-starup)-td20472233s134.html<http://www.nabble.com/status-from-shell-script-%28System-V-starup%29-td20472233s134.html>
>>>>
>>>>
>>
>
>
> --
> Ivan
>