Hello all,

I have a bash script that consists of two asynchronous sub-tasks, A
and B. Both subtasks normally finish within about 10 minutes.
Occasionally, one or the other sub-task takes quite a bit longer.  In
which case, I kill whatever sub-task is still running.

How can I ensure that the script does not take longer than 20 minutes
to complete?

My initial thinking is to create a "death" process that sleeps for 20
minutes, then kills any remaining background tasks.  While that is
running start the other sub-tasks with something like this:

taskA &
taskB &
wait
kill_death_process

In this setup, if the sub-tasks finish first, the death process is
killed.  If the death process finishes first, it kills all other
processes.

Is this the way to go or is there a cleaner way to do this?  Does this
pattern have a name (i.e. something I can Google)?

Thanks in advance for any pointers.

Regards,
- Robert

-- 
-- 
Central West End Linux Users Group (via Google Groups)
Main page: http://www.cwelug.org
To post: [email protected]
To subscribe: [email protected]
To unsubscribe: [email protected]
More options: http://groups.google.com/group/cwelug
--- 
You received this message because you are subscribed to the Google Groups 
"Central West End Linux Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to