Move reload hook to certrenew.service

This commit is contained in:
sup39 2023-05-29 10:52:05 +09:00
parent a9ddf5a2b6
commit e4d7c55e0a
No known key found for this signature in database
GPG key ID: 19D72AAF429D55D9
5 changed files with 9 additions and 18 deletions

View file

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

View file

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

View file

@ -1,3 +0,0 @@
[Unit]
Description=Services which need reloaded with SSL certs are updated
PropagatesReloadTo=nginx postfix dovecot

View file

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

View file

@ -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 <<EOF
Next step:
(1) edit $dst/certrenew.service
(2) $ sudo systemctl enable certrenew.service certrenew.timer certrenew.path
(3) $ sudo systemctl start certrenew.service certrenew.timer certrenew.target certrenew.path
(1) Edit $dst/certrenew.service
(2) Run the following commands:
sudo systemctl daemon-reload
sudo systemctl enable certrenew.service
sudo systemctl start certrenew.service certrenew.timer
EOF
if [ -z "$EDITOR" ]; then