timeout.1 (1692B)
- .\" utils-std: Collection of commonly available Unix tools
- .\" Copyright 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- .\" SPDX-License-Identifier: MPL-2.0
- .Dd 2024-07-22
- .Dt TIMEOUT 1
- .Os
- .Sh NAME
- .Nm timeout
- .Nd run a command with a time limit
- .Sh SYNOPSIS
- .Nm
- .Op Fl fp
- .Op Fl k Ar duration
- .Op Fl s Ar SIGNAL
- .Ar duration
- .Ar command
- .Op Ar argument...
- .Sh DESCRIPTION
- The
- .Nm
- utility executes
- .Ar command
- and terminates it, if still running after
- .Ar duration .
- .Pp
- .Ar duration
- is a non-negative decimal number including floats,
- optionally followed by a suffix: s for seconds (default), m for minutes, h for hours.
- .Sh OPTIONS
- .Bl -tag -width __
- .It Fl f
- Disables killing child processes.
- .It Fl k Ar duration
- Enables sending a
- .Dv SIGKILL
- after
- .Ar duration .
- .It Fl p
- Preserve (mimic) the wait status of
- .Ar command ,
- even after
- .Ar duration .
- .It Fl s Ar SIGNAL
- Signal to be sent on timeout, by default
- .Dv SIGTERM
- is sent.
- Signal may be a name like 'HUP' or 'SIGHUP', or a number like '9'.
- .Pp
- A list of signals may be obtained with
- .Cm kill
- .Fl l .
- .El
- .Sh EXIT STATUS
- The
- .Nm
- utility may return one of the following statuses:
- .Pp
- .Bl -tag -width 111 -compact
- .It 124
- Timeout reached
- .It 125
- Error within
- .Nm
- .It 126
- Failed to execute
- .Ar command
- .El
- .Pp
- Otherwise, the exit status of
- .Ar command
- is returned.
- .Sh SEE ALSO
- .Xr kill 1 ,
- .Xr sleep 1
- .Sh STANDARDS
- .Nm
- should be compliant with the
- IEEE Std 1003.1-2024 (“POSIX.1”)
- specification.
- .Sh HISTORY
- A
- .Nm
- utility appeared in SATAN, Netatalk, GNU Coreutils 7.0,
- .Ox 7.0 ,
- .Nx 7.0 ,
- .Fx 10.3 ,
- IEEE Std 1003.1-2024 (“POSIX.1”).
- .Sh AUTHORS
- .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me