logo

cmd-timer

run command at a specific interval git clone https://anongit.hacktivis.me/git/cmd-timer.git

timer.1 (1250B)


  1. .\" SPDX-FileCopyrightText: 2025 Haelwenn (lanodan) Monnier <contact+cmd-timer@hacktivis.me>
  2. .\" SPDX-License-Identifier: MPL-2.0
  3. .Dd June 18, 2025
  4. .Dt TIMER 1
  5. .Os
  6. .Sh NAME
  7. .Nm timer
  8. .Nd run command at a specific interval
  9. .Sh SYNOPSIS
  10. .Nm
  11. .Op Fl w
  12. .Ar interval
  13. .Ar command
  14. .Op Ar arguments
  15. .Sh DESCRIPTION
  16. The
  17. .Nm
  18. utility runs
  19. .Ar command
  20. at every
  21. .Ar interval .
  22. .Pp
  23. .Ar interval
  24. is a string containing non-negative decimal numbers including floats, terminated by suffixes:
  25. s for seconds, m for minutes, h for hours, d for days.
  26. .br
  27. If the final number doesn't have a suffix, seconds are assumed.
  28. Longer durations are taken as out of scope.
  29. .Pp
  30. If
  31. .Ar command
  32. exits with a non-zero status,
  33. .Nm
  34. exits with the same status, allowing to use service supervision to track failures.
  35. .Sh OPTIONS
  36. .Bl -item -width Ds
  37. .It Fl w
  38. Wait for
  39. .Ar interval
  40. to elapse.
  41. Otherwise
  42. .Nm
  43. immediately runs
  44. .Ar command
  45. after starting.
  46. .El
  47. .Sh EXIT STATUS
  48. .Ex -std
  49. .Sh EXAMPLES
  50. .Bl -bullet
  51. .It
  52. Run
  53. .Cm munin-cron
  54. every 5 minutes:
  55. .Nm
  56. .Ar 5m munin-cron
  57. .It
  58. Print bell every minute and a half:
  59. .Nm
  60. .Ar 1m30s printf '\ea'
  61. .El
  62. .Sh SEE ALSO
  63. .Xr at 1 ,
  64. .Xr crontab 1 ,
  65. .Xr sleep 1 ,
  66. .Xr timer_create 3
  67. .Sh AUTHORS
  68. .An Haelwenn (lanodan) Monnier Aq Mt contact+cmd-timer@hacktivis.me