logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git

timeout.1 (1692B)


  1. .\" utils-std: Collection of commonly available Unix tools
  2. .\" Copyright 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. .\" SPDX-License-Identifier: MPL-2.0
  4. .Dd 2024-07-22
  5. .Dt TIMEOUT 1
  6. .Os
  7. .Sh NAME
  8. .Nm timeout
  9. .Nd run a command with a time limit
  10. .Sh SYNOPSIS
  11. .Nm
  12. .Op Fl fp
  13. .Op Fl k Ar duration
  14. .Op Fl s Ar SIGNAL
  15. .Ar duration
  16. .Ar command
  17. .Op Ar argument...
  18. .Sh DESCRIPTION
  19. The
  20. .Nm
  21. utility executes
  22. .Ar command
  23. and terminates it, if still running after
  24. .Ar duration .
  25. .Pp
  26. .Ar duration
  27. is a non-negative decimal number including floats,
  28. optionally followed by a suffix: s for seconds (default), m for minutes, h for hours.
  29. .Sh OPTIONS
  30. .Bl -tag -width __
  31. .It Fl f
  32. Disables killing child processes.
  33. .It Fl k Ar duration
  34. Enables sending a
  35. .Dv SIGKILL
  36. after
  37. .Ar duration .
  38. .It Fl p
  39. Preserve (mimic) the wait status of
  40. .Ar command ,
  41. even after
  42. .Ar duration .
  43. .It Fl s Ar SIGNAL
  44. Signal to be sent on timeout, by default
  45. .Dv SIGTERM
  46. is sent.
  47. Signal may be a name like 'HUP' or 'SIGHUP', or a number like '9'.
  48. .Pp
  49. A list of signals may be obtained with
  50. .Cm kill
  51. .Fl l .
  52. .El
  53. .Sh EXIT STATUS
  54. The
  55. .Nm
  56. utility may return one of the following statuses:
  57. .Pp
  58. .Bl -tag -width 111 -compact
  59. .It 124
  60. Timeout reached
  61. .It 125
  62. Error within
  63. .Nm
  64. .It 126
  65. Failed to execute
  66. .Ar command
  67. .El
  68. .Pp
  69. Otherwise, the exit status of
  70. .Ar command
  71. is returned.
  72. .Sh SEE ALSO
  73. .Xr kill 1 ,
  74. .Xr sleep 1
  75. .Sh STANDARDS
  76. .Nm
  77. should be compliant with the
  78. IEEE Std 1003.1-2024 (“POSIX.1”)
  79. specification.
  80. .Sh HISTORY
  81. A
  82. .Nm
  83. utility appeared in SATAN, Netatalk, GNU Coreutils 7.0,
  84. .Ox 7.0 ,
  85. .Nx 7.0 ,
  86. .Fx 10.3 ,
  87. IEEE Std 1003.1-2024 (“POSIX.1”).
  88. .Sh AUTHORS
  89. .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me