I want to run a shell script that got a loop in it and it can go for ever which I do not want to happen. So I need to introduce a timeout for the whole script.
How can I introduce a timeout for the whole shell script under SuSE?
|
I want to run a shell script that got a loop in it and it can go for ever which I do not want to happen. So I need to introduce a timeout for the whole script. How can I introduce a timeout for the whole shell script under SuSE? |
||||
|
If GNU
Edit Example:
|
|||||||||
|
|
Thank you for the clarification. The easiest way to accomplish what you're after is to run your script with the loop within a wrapper like the
In the end, it will be much easier than writing your own timeout function, which shells tend to not have builtin. |
|||
|
|
|
Launch a watchdog process from within your script to kill off its parent if it runs too long. Example:
This script will be terminated by the watchdog after five seconds. |
|||||||||
|
|
There's also
|
|||
|
|
timeoutorexpect) – Gilles Jul 18 '12 at 23:37