[BACK]Return to timeout.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / timeout

Annotation of src/usr.bin/timeout/timeout.1, Revision 1.6

1.6     ! jmc         1: .\"    $OpenBSD: timeout.1,v 1.5 2023/01/10 14:19:12 job Exp $
1.1       job         2: .\"    $NetBSD: timeout.1,v 1.4 2016/10/13 06:22:26 dholland Exp $
                      3: .\"
                      4: .\" Copyright (c) 2014 Baptiste Daroussin <bapt@FreeBSD.org>
                      5: .\" All rights reserved.
                      6: .\"
                      7: .\" Redistribution and use in source and binary forms, with or without
                      8: .\" modification, are permitted provided that the following conditions
                      9: .\" are met:
                     10: .\" 1. Redistributions of source code must retain the above copyright
                     11: .\"    notice, this list of conditions and the following disclaimer.
                     12: .\" 2. Redistributions in binary form must reproduce the above copyright
                     13: .\"    notice, this list of conditions and the following disclaimer in the
                     14: .\"    documentation and/or other materials provided with the distribution.
                     15: .\"
                     16: .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
                     17: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     18: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     19: .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
                     20: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     21: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     22: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     23: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     24: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     25: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     26: .\" SUCH DAMAGE.
                     27: .\"
                     28: .\" $FreeBSD: head/usr.bin/timeout/timeout.1 268861 2014-07-18 22:56:59Z bapt $
                     29: .\"
1.6     ! jmc        30: .Dd $Mdocdate: January 10 2023 $
1.1       job        31: .Dt TIMEOUT 1
                     32: .Os
                     33: .Sh NAME
                     34: .Nm timeout
                     35: .Nd run a command with a time limit
                     36: .Sh SYNOPSIS
                     37: .Nm
1.5       job        38: .Op Fl fp
1.2       jmc        39: .Op Fl k Ar time
                     40: .Op Fl s Ar sig
                     41: .Ar duration
                     42: .Ar command
1.4       kn         43: .Op Ar arg ...
1.1       job        44: .Sh DESCRIPTION
1.2       jmc        45: The
1.1       job        46: .Nm
1.2       jmc        47: utility executes
1.4       kn         48: .Ar command
1.2       jmc        49: and kills it if it is still running after the
                     50: specified
                     51: .Ar duration .
1.1       job        52: If
1.2       jmc        53: .Ar duration
                     54: is 0, the timeout is disabled.
                     55: .Pp
                     56: The options are as follows:
                     57: .Bl -tag -width Ds
1.5       job        58: .It Fl f , -foreground
                     59: Do not propagate the timeout signal to children processes.
1.2       jmc        60: .It Fl k Ar time , Fl -kill-after Ns = Ns Ar time
1.3       schwarze   61: Send a second signal,
                     62: .Dv SIGKILL ,
                     63: if the command is still running
1.6     ! jmc        64: .Ar time
        !            65: after the first signal was sent.
1.5       job        66: .It Fl p , -preserve-status
                     67: Always exit with the same status as
                     68: .Ar command ,
                     69: even if the timeout was reached.
1.2       jmc        70: .It Fl s Ar sig , Fl -signal Ns = Ns Ar sig
                     71: Specify the signal to send on timeout, instead of the default
                     72: .Dv SIGTERM .
1.1       job        73: .El
                     74: .Sh DURATION FORMAT
                     75: .Ar duration
                     76: and
                     77: .Ar time
1.2       jmc        78: may contain a decimal fraction.
                     79: The value defaults to seconds unless a unit suffix is given.
                     80: .Pp
                     81: The supported unit suffixes are:
1.1       job        82: .Pp
1.2       jmc        83: .Bl -tag -width Ds -offset indent -compact
1.1       job        84: .It s
                     85: seconds
                     86: .It m
                     87: minutes
                     88: .It h
                     89: hours
                     90: .It d
                     91: days
                     92: .El
                     93: .Sh EXIT STATUS
1.3       schwarze   94: If the timeout was not reached or
1.5       job        95: .Fl p
1.3       schwarze   96: was set, the exit status of
1.1       job        97: .Ar command
                     98: is returned.
                     99: .Pp
                    100: If the timeout was reached and
1.5       job       101: .Fl p
1.2       jmc       102: was not set, an exit status of 124 is returned.
1.1       job       103: .Pp
                    104: If
                    105: .Ar command
1.2       jmc       106: exited after receiving a signal, the exit status returned is the signal number
                    107: plus 128.
1.1       job       108: .Sh SEE ALSO
                    109: .Xr kill 1 ,
                    110: .Xr signal 3
                    111: .Sh HISTORY
                    112: The
                    113: .Nm
1.3       schwarze  114: utility first appeared in GNU Coreutils 7.0 and has been available since
                    115: .Ox 7.0 .