From 082a4cb6729ec13eed0f3fdf98027593b2f40361 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Wed, 30 Jul 2025 13:54:55 -0400 Subject: [PATCH] systemd: add units for a service and timer Signed-off-by: Vincent Batts --- README.md | 6 ++++++ too-soon-remote@.service | 5 +++++ too-soon-remote@.timer | 10 ++++++++++ 3 files changed, 21 insertions(+) create mode 100644 too-soon-remote@.service create mode 100644 too-soon-remote@.timer diff --git a/README.md b/README.md index e89804c..fdeb1e3 100644 --- a/README.md +++ b/README.md @@ -64,3 +64,9 @@ Whether you use a cronjob or a systemd timer, you can chain this command to a da ```shell too-soon pem "fullchain.pem" || mail -s "$(shell hostname): certificates expire soon" webmaster@example.com ``` + +## `systemd` units + +Copy the `too-soon-remote@.service` and `too-soon-remote@.timer` to `/etc/systemd/system/` after making sure the path to the `too-soon` binary is correct (preset as `/usr/local/bin/too-soon`). +Then `systemct enable --now too-soon-remote@example.com.timer`. + diff --git a/too-soon-remote@.service b/too-soon-remote@.service new file mode 100644 index 0000000..ec61f36 --- /dev/null +++ b/too-soon-remote@.service @@ -0,0 +1,5 @@ +[Unit] +Description=check domain's certificate expiration and alert if expires within 20d + +[Service] +ExecStart="/usr/local/bin/too-soon" "-D" "remote" "%i" diff --git a/too-soon-remote@.timer b/too-soon-remote@.timer new file mode 100644 index 0000000..a9fc2f7 --- /dev/null +++ b/too-soon-remote@.timer @@ -0,0 +1,10 @@ +[Unit] +Description=check domain's certificate expiration and alert if expires within 20d + +[Timer] +OnCalendar=*-*-* 6:00 +RemainAfterElapse=no + +[Install] +WantedBy=timers.target +