logo

cmd-timer

run command at a specific interval git clone https://anongit.hacktivis.me/git/cmd-timer.git
commit: c527057fb387e101c5d9788a3dd6d162d823efe5
parent c37db06adf826bafee8bd4d42de58a4334c8315b
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Wed, 18 Jun 2025 12:27:57 +0200

timer.1: Add manpage

Diffstat:

MMakefile4++++
Atimer.155+++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile @@ -3,6 +3,8 @@ PREFIX ?= /usr/local BINDIR ?= ${PREFIX}/bin +MANDIR ?= ${PREFIX}/share/man +MAN1DIR ?= ${MANDIR}/man1 TIMER_SRC_C = timer.c strtodur.o timer: ${TIMER_SRC_C} timer.h @@ -26,3 +28,5 @@ format: install: mkdir -p ${DESTDIR}${BINDIR}/ cp -p ./timer ${DESTDIR}${BINDIR}/timer + mkdir -p ${DESTDIR}${MAN1DIR}/ + cp -p ./timer.1 ${DESTDIR}${MAN1DIR}/timer.1 diff --git a/timer.1 b/timer.1 @@ -0,0 +1,55 @@ +.\" SPDX-FileCopyrightText: 2025 Haelwenn (lanodan) Monnier <contact+cmd-timer@hacktivis.me> +.\" SPDX-License-Identifier: MIT +.Dd June 18, 2025 +.Dt TIMER 1 +.Os +.Sh NAME +.Nm timer +.Nd run command at a specific interval +.Sh SYNOPSIS +.Nm +.Ar interval +.Ar command +.Op Ar arguments +.Sh DESCRIPTION +The +.Nm +utility runs +.Ar command +at every +.Ar interval . +.Pp +.Ar interval +is a string containing numbers, terminated by suffixes: +s for seconds, m for minutes, h for hours, d for days. +.br +If the final number doesn't have a suffix, seconds are assumed. +Longer durations are taken as out of scope. +.Pp +If +.Ar command +exits with a non-zero status, +.Nm +exits with the same status, allowing to use service supervision to track failures. +.Sh EXIT STATUS +.Ex -std +.Sh EXAMPLES +.Bl -bullet +.It +Run +.Cm munin-cron +every 5 minutes: +.Nm +.Ar 5m munin-cron +.It +Print bell every minute and a half: +.Nm +.Ar 1m30s printf '\ea' +.El +.Sh SEE ALSO +.Xr at 1 , +.Xr crontab 1 , +.Xr sleep 1 , +.Xr timer_create 3 +.Sh AUTHORS +.An Haelwenn (lanodan) Monnier Aq Mt contact+cmd-timer@hacktivis.me