I have a long running BASH script that I am running under CYGWIN on Windows.
I would like to limit the script to run for 30 seconds, and automatically terminate if it exceeds this limit. Ideally, I’d like to be able to do this to any command.
For example:
$ limittime -t 30 'myscript.sh'
or
$ limittime -t 30 'grep func *.c'
Under cygwin the ulimit command doesn’t seem to work.
See the http://www.pixelbeat.org/scripts/timeout script the functionality of which has been integrated into newer coreutils: