NAME
timeout
—
run a command with a time
limit
SYNOPSIS
timeout |
[-fp ] [-k
time] [-s
signal] duration
command [arg ...] |
DESCRIPTION
The 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:
-f
,--foreground
- Do not propagate the timeout signal to children processes.
-k
time,--kill-after
=time- Send a second signal,
SIGKILL
, if the command is still running time after the first signal was sent. -p
,--preserve-status
- Always exit with the same status as command, even if the timeout was reached.
-s
signal,--signal
=signal- A non-negative decimal number or symbolic signal name specifying the
signal to send on timeout, instead of the default
SIGTERM
.
DURATION FORMAT
duration and time may contain a decimal fraction. The value defaults to seconds unless a unit suffix is given.
The supported unit suffixes are:
- s
- seconds
- m
- minutes
- h
- hours
- d
- days
EXIT STATUS
If the timeout was not reached or -p
was
set, the exit status of command is returned.
If the timeout was reached and -p
was not
set, an exit status of 124 is returned.
If command exited after receiving a signal, the exit status returned is the signal number plus 128.
SEE ALSO
HISTORY
The timeout
utility first appeared in GNU
Coreutils 7.0 and has been available since OpenBSD
7.0.