coreutils: timeout invocation
1
1 23.6 ‘timeout’: Run a command with a time limit
1 ===============================================
1
1 ‘timeout’ runs the given COMMAND and kills it if it is still running
1 after the specified time interval. Synopsis:
1
1 timeout [OPTION] DURATION COMMAND [ARG]...
1
11 COMMAND must not be a special built-in utility (⇒Special
built-in utilities).
1
11 The program accepts the following options. Also see ⇒Common
options. Options must precede operands.
1
1 ‘--preserve-status’
1 Return the exit status of the managed COMMAND on timeout, rather
1 than a specific exit status indicating a timeout. This is useful
1 if the managed COMMAND supports running for an indeterminate amount
1 of time.
1
1 ‘--foreground’
1 Don’t create a separate background program group, so that the
1 managed COMMAND can use the foreground TTY normally. This is
1 needed to support timing out commands not started directly from an
1 interactive shell, in two situations.
1 1. COMMAND is interactive and needs to read from the terminal for
1 example
1 2. the user wants to support sending signals directly to COMMAND
1 from the terminal (like Ctrl-C for example)
1
1 Note in this mode of operation, any children of COMMAND will not be
1 timed out. Also SIGCONT will not be sent to COMMAND, as it’s
1 generally not needed with foreground processes, and can cause
1 intermittent signal delivery issues with programs that are monitors
1 themselves (like GDB for example).
1
1 ‘-k DURATION’
1 ‘--kill-after=DURATION’
1 Ensure the monitored COMMAND is killed by also sending a ‘KILL’
1 signal, after the specified DURATION. Without this option, if the
1 selected signal proves not to be fatal, ‘timeout’ does not kill the
1 COMMAND.
1
1 ‘-s SIGNAL’
1 ‘--signal=SIGNAL’
1 Send this SIGNAL to COMMAND on timeout, rather than the default
11 ‘TERM’ signal. SIGNAL may be a name like ‘HUP’ or a number. ⇒
Signal specifications.
1
1 ‘-v’
1 ‘--verbose’
1 Diagnose to stderr, any signal sent upon timeout.
1
1 DURATION is a floating point number followed by an optional unit:
1 ‘s’ for seconds (the default)
1 ‘m’ for minutes
1 ‘h’ for hours
1 ‘d’ for days
1 A duration of 0 disables the associated timeout. Note that the
1 actual timeout duration is dependent on system conditions, which should
1 be especially considered when specifying sub-second timeouts.
1
1 Exit status:
1
1 124 if COMMAND times out
1 125 if ‘timeout’ itself fails
1 126 if COMMAND is found but cannot be invoked
1 127 if COMMAND cannot be found
1 137 if COMMAND is sent the KILL(9) signal (128+9)
1 the exit status of COMMAND otherwise
1