systemd: add units for a service and timer

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2025-07-30 13:54:55 -04:00
parent f8a6a4deca
commit 082a4cb672
Signed by: vbatts
GPG key ID: E30EFAA812C6E5ED
3 changed files with 21 additions and 0 deletions

View file

@ -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`.

5
too-soon-remote@.service Normal file
View file

@ -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"

10
too-soon-remote@.timer Normal file
View file

@ -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