From e4d7c55e0a57b6211b4388e0dab991d062a4302c Mon Sep 17 00:00:00 2001 From: sup39 Date: Mon, 29 May 2023 10:52:05 +0900 Subject: [PATCH] Move reload hook to certrenew.service --- certrenew.path | 8 -------- certrenew.service | 3 +++ certrenew.target | 3 --- enable.sh | 3 --- setup.sh | 10 ++++++---- 5 files changed, 9 insertions(+), 18 deletions(-) delete mode 100644 certrenew.path delete mode 100644 certrenew.target delete mode 100644 enable.sh diff --git a/certrenew.path b/certrenew.path deleted file mode 100644 index 1a79c20..0000000 --- a/certrenew.path +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Restart services which use SSL when the cert directory changes - -[Path] -PathChanged=/etc/letsencrypt/live - -[Install] -WantedBy=multi-user.target diff --git a/certrenew.service b/certrenew.service index d395465..239ae2a 100644 --- a/certrenew.service +++ b/certrenew.service @@ -15,5 +15,8 @@ Type=simple ## porkbun #ExecStart=/usr/bin/certbot renew --non-interactive --agree-tos --preferred-challenges dns --authenticator dns-porkbun --dns-porkbun-credentials /etc/certbot/porkbun.ini --dns-porkbun-propagation-seconds 10 +## Reload the following services after renewing certs +ExecStopPost=/bin/systemctl reload nginx postfix dovecot + [Install] WantedBy=multi-user.target diff --git a/certrenew.target b/certrenew.target deleted file mode 100644 index 2635936..0000000 --- a/certrenew.target +++ /dev/null @@ -1,3 +0,0 @@ -[Unit] -Description=Services which need reloaded with SSL certs are updated -PropagatesReloadTo=nginx postfix dovecot diff --git a/enable.sh b/enable.sh deleted file mode 100644 index b605138..0000000 --- a/enable.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -sudo systemctl enable certrenew.service certrenew.timer certrenew.path -sudo systemctl start certrenew.service certrenew.timer certrenew.target certrenew.path diff --git a/setup.sh b/setup.sh index 55c6dc1..d2f2d01 100644 --- a/setup.sh +++ b/setup.sh @@ -5,14 +5,16 @@ if [ ! -w "$dst" ]; then echo "$dst is not writable. Download to /tmp instead" dst=/tmp fi -wget -P "$dst" "$baseURL/certrenew.service" "$baseURL/certrenew.timer" "$baseURL/certrenew.target" "$baseURL/certrenew.path" +wget -P "$dst" "$baseURL/certrenew.service" "$baseURL/certrenew.timer" cat <