coreutils timeout and other timeout script i searched, they apply for a CDM
but i'd like to apply timeout for a linux script, if not finished for a period. like:
cd XXX && CMD && sleep 3 && kill -0 XX
How to do it?
coreutils timeout and other timeout script i searched, they apply for a CDM
but i'd like to apply timeout for a linux script, if not finished for a period. like:
cd XXX && CMD && sleep 3 && kill -0 XX
How to do it?
You can pass the spawning of a subshell to timeout, and have the subshell run the code that needs to be timed out:
#!/bin/bash
timeout 5 bash -c "ping google.com -c 2; ping yahoo.com -c 10"
If you clarify what you need exactly there may be cleaner ways to achieve this.