Timing out the execution of a command

31 May 2007

You want to stop the execution of a command after, say, ten seconds.

Use ulimit and wrap your command execution in a shell script.

#!/bin/sh
ulimit -t 10
# your command here