Allowing a script to continue executing when a command hangs

Hello all,

I'm writing a script in c-shell that, among other things, queries information from another system. Is there a graceful way I can continue execution of the script if that query command(rup) causes the script to hang?

Thanks much!

Start the problem command in the background?

PxT,

Could it be that simple? I was thinking more along the lines of a timeout for the command, but I'll certainly give that a try. Thanks for the input...

Is there a pre-determined time for command execution? For example, command CommandA should take between 10 and 30 seconds?

You could start the process in the background and monitor it in a tight loop. If the process dies in the allotted time (assuming success) continue on. If the process takes longer than allotted time, kill it off and then decide what to do next.

Even going a step beyond that, you can write wrapper scripts to set the success/failure status in a semaphore file for reading by the main script.

Not exactly what you were looking for, but it should work.

Auswipe,

That was the ticket, a timed loop with a kill PID for the command after it dropped through the loop.

Appreciate it...

Glad to be of assistance.