Quit when an error occurs

Davide Sotil Bertanzetti davide at CEAM.ES
Fri Aug 18 03:17:31 EDT 2006


I have tested the "x" option in my LINUX plataform and it works too. I'm not
sure about Marcus, but yes, this is what I was looking for!. I don't know
where you find this option but thank you, Diane!

I think that this, in my opinion, useful "x" option should be documented. I
don't know why, maybe because it doesn't work on all platforms, but this
option doesn't appears in the actual documentation:

You may specify the following options as arguments to the grads command when
GrADS is started:

-b    Run grads in batch mode. No graphics output window is opened.
-l    Run grads in landscape mode. The Portrait vs. Landscape question is
not asked.
-p    Run grads in portrait mode.
-c    Execute the supplied command as the 1 st GrADS command after GrADS is
started.


Davide.



On Thu, 17 Aug 2006 11:01:14 -0400, Diane Stokes <Diane.Stokes at NOAA.GOV> wrote:

>Davide and Marcus,
>
>The following works for me in 1.8SL11 and 1.9b4 on AIX.
>
>If you include the "x" option, eg:
>    grads -blcx myscript.gs
>grads will quit when the script/command is done, even if it terminated
>early due to error.  An error code is returned to the operating system
>if you want to check that the script ran successfully.
>
>Is that what you were looking for?
>    Diane
>
>
>Davide Sotil Bertanzetti wrote:
>> I think I'm also interested in that question, if I understand. If I'm
>> correct, the last reply is not what Marcus is asking for. The problem is not
>> to quit GRADS if no parameter is supplied externally to the GRADS program.
>> The problem is that, when executing GRADS programs in batch mode using
>> "grads -bl -c", if an error ocurrs in the GRADS program, no error exit code
>> is given to the operative system (SO). Instead of that, the GRADS command
>> line appears, so the "grads -bl -c" SO command keeps running until is
>> manually killed, as Marcus said.
>>
>> So, as I've explained, in GRADS programs running on batch with the "grads
>> -bl -c" command, is there a way to force GRADS to give an error code to de
>> SO when an error ocurrs in the GRADS program, instead of showing the GRADS
>> command line?.
>>
>>
>> Davide Sotil Bertanzetti.
>>
>>
>>
>> On Wed, 9 Aug 2006 16:43:56 -0400, Charles Seman <Charles.Seman at NOAA.GOV>
wrote:
>>
>>> Marcus,
>>>
>>> I'm not sure if I understand your question?
>>>
>>> Here's a way to quit a GrADS script, depending on whether you're in
>>> batch mode... When running in batch mode, you can supply the parameters
>>> to the script which you would otherwise type in after being prompted in
>>> an interactive run (I hope this makes sense?)... the "if-then" test on
>>> "batch_mode" would also be used to determine whether to parse out the
>>> "args" parameters...
>>>
>>> ---
>>> function basic (args)
>>> 'reinit'
>>>
>>> if( args = '' )
>>> ...
>>>  batch_mode = 'no'
>>> else
>>> ...
>>>  batch_mode = 'yes'
>>> endif
>>> ...
>>> if( batch_mode = 'yes' )
>>>  quit
>>> endif
>>> return
>>>
>>> I hope this helps,
>>> Chuck
>>>
>>> ---
>>>
>>> Marcus Carvalho wrote:
>>>> Does anybody knows if there's a way to exit the GrADS process when an
>>>> error occurs in batch mode?!
>>>>
>>>> On 7/18/06, *Marcus Carvalho* < marcuswac at gmail.com
>>>> <mailto:marcuswac at gmail.com>> wrote:
>>>>
>>>>     Hi...
>>>>     I've got some Grads scripts that are executed daily in my system
>>>>     automaticaly. But, when an error occurs, the execution stops and
>>>>     stays blocked, waiting someone to type something in the command
>>>>     line. As I'm running in batch mode, I've got to kill the proccess
>>>>     to exit Grads.
>>>>     Is there any way to 'exit' Grads automaticaly when an fatal error
>>>>     occurs?
>>>>
>>>>     Thanks,
>>>>
>>>>       Marcus Carvalho.
>>>>
>>>>
>>> --
>>>
>>> Please note that Charles.Seman at noaa.gov should be considered my NOAA
>>> email address, not cjs at gfdl.noaa.gov.
>>>
>>> ********************************************************************
>>> Charles Seman                                Charles.Seman at noaa.gov
>>> U.S. Department of Commerce / NOAA / OAR
>>> Geophysical Fluid Dynamics Laboratory         voice: (609) 452-6547
>>> 201 Forrestal Road                              fax: (609) 987-5063
>>> Princeton, NJ  08540-6649            http://www.gfdl.noaa.gov/~cjs/
>>> ********************************************************************
>>>
>>> "The contents of this message are mine personally and do not reflect
>>> any position of the Government or NOAA."
>>
>
>--
>Diane Stokes
>Environmental Modeling Center
>National Weather Service/NOAA



More information about the gradsusr mailing list