Main index | Section 1 | Options |
The options are as follows:
| |
Exit with the same status as command, even if it times out and is killed. | |
| |
Do not propagate timeout to the children of command. | |
| |
Specify the signal to send on timeout. By default, SIGTERM is sent. | |
| |
Send a SIGKILL signal if command is still running after time after the first signal was sent. | |
Supported unit symbols are:
s | seconds |
m | minutes |
h | hours |
d | days |
If the timeout was reached and
If command exits after receiving a signal, the exit status returned is the signal number plus 128.
If command refers to a non-existing program, the exit status returned is 127.
If command is an otherwise invalid program, the exit status returned is 126.
If an invalid parameter is passed to
$ timeout 4 sleep 2 $ echo $? 0
Run
sleep(1)
for 4 seconds and terminate process after 2 seconds.
124 is returned since no
$ timeout 2 sleep 4 $ echo $? 124
Same as above but preserving status. Exit status is 128 + signal number (15 for SIGTERM):
$ timeout --preserve-status 2 sleep 4 $ echo $? 143
Same as above but sending SIGALRM (signal number 14) instead of SIGTERM:
$ timeout --preserve-status -s SIGALRM 2 sleep 4 $ echo $? 142
Try to fetch(1) the single page version of the FreeBSD Handbook. Send a SIGTERM signal after 1 minute and send a SIGKILL signal 5 seconds later if the process refuses to stop:
$ timeout -k 5s 1m fetch \ > https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html
TIMEOUT (1) | October 21, 2021 |
Main index | Section 1 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
“ | Ken Thompson was once asked by a reporter what he would have changed about Unix if he had it all to do over again. His answer: “I would spell creat with an ‘e.'” | ” |