Annotation of src/usr.bin/timeout/timeout.1, Revision 1.1
1.1 ! job 1: .\" $NetBSD: timeout.1,v 1.4 2016/10/13 06:22:26 dholland Exp $
! 2: .\"
! 3: .\" Copyright (c) 2014 Baptiste Daroussin <bapt@FreeBSD.org>
! 4: .\" All rights reserved.
! 5: .\"
! 6: .\" Redistribution and use in source and binary forms, with or without
! 7: .\" modification, are permitted provided that the following conditions
! 8: .\" are met:
! 9: .\" 1. Redistributions of source code must retain the above copyright
! 10: .\" notice, this list of conditions and the following disclaimer.
! 11: .\" 2. Redistributions in binary form must reproduce the above copyright
! 12: .\" notice, this list of conditions and the following disclaimer in the
! 13: .\" documentation and/or other materials provided with the distribution.
! 14: .\"
! 15: .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
! 16: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 17: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 18: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
! 19: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 20: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 21: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 22: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 23: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 24: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 25: .\" SUCH DAMAGE.
! 26: .\"
! 27: .\" $FreeBSD: head/usr.bin/timeout/timeout.1 268861 2014-07-18 22:56:59Z bapt $
! 28: .\"
! 29: .Dd July 19, 2014
! 30: .Dt TIMEOUT 1
! 31: .Os
! 32: .Sh NAME
! 33: .Nm timeout
! 34: .Nd run a command with a time limit
! 35: .Sh SYNOPSIS
! 36: .Nm
! 37: .Op Fl Fl signal Ar sig | Fl s Ar sig
! 38: .Op Fl Fl preserve-status
! 39: .Op Fl Fl kill-after Ar time | Fl k Ar time
! 40: .Op Fl Fl foreground
! 41: .Ao Ar duration Ac
! 42: .Ao Ar command Ac
! 43: .Ao Ar args ... Ac
! 44: .Sh DESCRIPTION
! 45: .Nm
! 46: starts the
! 47: .Ar command
! 48: with its
! 49: .Ar args .
! 50: If
! 51: .Ar command
! 52: is still running after
! 53: .Ar duration ,
! 54: it is killed.
! 55: By default,
! 56: .Dv SIGTERM
! 57: is sent.
! 58: .Bl -tag -width "-k time, --kill-after time"
! 59: .It Fl Fl preserve-status
! 60: Always exits with the same status as
! 61: .Ar command
! 62: even if it times out.
! 63: .It Fl Fl foreground
! 64: Do not propagate timeout to the
! 65: .Ar command
! 66: children.
! 67: .It Fl s Ar sig , Fl Fl signal Ar sig
! 68: Specify the signal to send on timeout.
! 69: By default,
! 70: .Dv SIGTERM
! 71: is sent.
! 72: .It Fl k Ar time , Fl Fl kill-after Ar time
! 73: Send a second kill signal if
! 74: .Ar command
! 75: is still running after
! 76: .Ar time
! 77: after the first signal was sent.
! 78: .El
! 79: .Sh DURATION FORMAT
! 80: .Ar duration
! 81: and
! 82: .Ar time
! 83: can be integer or decimal numbers.
! 84: Values without unit symbols are interpreted as seconds.
! 85: .Pp
! 86: Supported unit symbols are:
! 87: .Bl -tag -width indent -compact
! 88: .It s
! 89: seconds
! 90: .It m
! 91: minutes
! 92: .It h
! 93: hours
! 94: .It d
! 95: days
! 96: .El
! 97: .Sh EXIT STATUS
! 98: If the timeout was not reached, the exit status of
! 99: .Ar command
! 100: is returned.
! 101: .Pp
! 102: If the timeout was reached and
! 103: .Fl Fl preserve-status
! 104: is set, the exit status of
! 105: .Ar command
! 106: is returned.
! 107: If
! 108: .Fl Fl preserve-status
! 109: is not set, an exit status of 124 is returned.
! 110: .Pp
! 111: If
! 112: .Ar command
! 113: exits after receiving a signal, the exit status returned is the signal number plus 128.
! 114: .Sh SEE ALSO
! 115: .Xr kill 1 ,
! 116: .Xr signal 3
! 117: .Sh HISTORY
! 118: A
! 119: .Nm
! 120: utility appeared in a development branch of
! 121: .Fx 11
! 122: and was imported into
! 123: .Nx 7 .
! 124: The
! 125: .Fx
! 126: work is compatible with GNU
! 127: .Nm
! 128: by
! 129: .An Padraig Brady ,
! 130: from GNU Coreutils 8.21.
! 131: The
! 132: .Nm
! 133: utility first appeared in GNU Coreutils 7.0.