shell calls

General development discussion.

Moderators: Susan Smith, admin, Gabriel

Post Reply
John
Posts: 555
Joined: Sun Apr 26, 2009 8:27 am

shell calls

Post by John »

what is the right way to disable timeout on an individual shell call? (to avoid the 4591) with out setting shell limit in the brconfig.sys?

I tried SY -t0 but that made it timeout immediately.

-john
John
Posts: 555
Joined: Sun Apr 26, 2009 8:27 am

Post by John »

currently i'm using -t9999 - which I believe will work for 2.7 hours, but I'd really like them to be able to leave this open all day if they want.
Gabriel
Posts: 412
Joined: Sun Aug 10, 2008 7:37 am
Location: Arlington, TX
Contact:

Post by Gabriel »

Instead of calling your program directly, call a batch file.

Your batch file should call the program you want, then create an output file indicating that its done.

Your BR program should call the batch file with the -C parameter, so that it doesn't wait at all and also doesn't give an error. Right after calling the batch file, you loop, waiting until the "done indicator" file appears telling you its done.

This is just an idea, I'm just brainstorming here, I haven't tried it. It seems like it would work but it may not. It would be nice if there is a parameter we're just not aware of to make the System call not ever timeout. (have you tried -1)?

Gabriel
John
Posts: 555
Joined: Sun Apr 26, 2009 8:27 am

Post by John »

I believe your batch file method should work. I'm surprised that there isn't a way to do this in BR! without having to write another program in a different language (batch).

Also I tried the -t-1 but it gave an error 4501 (invalid shell call)

Thanks for the tip.
David Bohlke
Posts: 4
Joined: Mon Jun 08, 2009 9:58 pm

Post by David Bohlke »

John, your batch file (with a .bat extension) can be as simple as:
path\file.exe (Whatever your called program is)
echo >testdone (or whatever file name you would test for)
In your BR program, while looping to check for file "testdone" add a SLEEP(n) to pause it for n seconds so it doesn't chew up processor time in a hard loop. Also need to delete file "testdone" in the BR program after waiting for it.
gordon
Posts: 358
Joined: Fri Apr 24, 2009 6:02 pm

Post by gordon »

Taken from the BR_CS.TXT file in Dll_Distr/DOC:
SHELL LIMIT 9999
Sets default timeout - maximum seconds to wait for a child process.
If not specified, this value is set to 240 seconds. Minus one ( -1 )
indicates never timeout unless -t is specified in the System command.
Please note that the -1 refers to the SHELL LIMIT statement, not the -t parameter.
The -t is mentioned as an exception to the "no limit" setting.
Gabriel
Posts: 412
Joined: Sun Aug 10, 2008 7:37 am
Location: Arlington, TX
Contact:

Post by Gabriel »

So what is the appropriate code to use if you don't want to change the timeout values on any other shell calls, but you want just one specific shell call to have an infinite wait time?
John
Posts: 555
Joined: Sun Apr 26, 2009 8:27 am

Post by John »

which is exactly what I'd like to do (what gabriel said)
bluesfannoz
Posts: 291
Joined: Fri Jun 19, 2009 9:01 am
Location: Lawrence, Kansas
Contact:

Post by bluesfannoz »

Gabe and John you already answered your own question...

-C gives you a shell call without any timeout so there is no need for a parameter on the -t flag.

If your needing BR to know when you exited the shell. You have to setup a trigger like Gabe mentioned of something to look for in BR when the shell completes, that can be a file or an ENV$ variable changed or another of different triggers. Since we created our own EXE's that we call outside BR we built in a stshell.tmp file that is set to read only and BR watches until it can successfully write to stshell.tmp without a 4205 error. In our EXE it locks stshell.tmp when it first executes and unlocks it when it exits. Thus the 4205 error when BR attempts to write to it.
Steve Koger
Computer Specialist
SEKESC-MACS Division
Gabriel
Posts: 412
Joined: Sun Aug 10, 2008 7:37 am
Location: Arlington, TX
Contact:

Post by Gabriel »

John, if you're not using shell default currently it may be ok to change it to -1. If you are using it, you may be able to temporarily override it with execute config shelldefault -1 then set it back when you're done.
Post Reply