Quit when an error occurs
Diane Stokes
Diane.Stokes at NOAA.GOV
Thu Aug 17 11:01:14 EDT 2006
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