run a command with a time
timeout utility executes
command and kills it if it is still running after the
specified duration. If duration
is 0, the timeout is disabled.
The options are as follows:
- Do not propagate the timeout signal to children processes.
- Send a second signal,
SIGKILL, if the command is still running time after the first signal was sent.
- Always exit with the same status as command, even if the timeout was reached.
- A non-negative decimal number or symbolic signal name specifying the
signal to send on timeout, instead of the default
duration and time may contain a decimal fraction. The value defaults to seconds unless a unit suffix is given.
The supported unit suffixes are:
timeout utility may return one of the
- The time limit expired and the
-pflag was not set.
- The command was found but could not be executed.
- The command was not found.
timeout returns the exit status
of the command.
timeout utility first appeared in GNU
Coreutils 7.0 and has been available since OpenBSD