rework systemd stuff

move service to paths.target
remove startup dependency
change to try-reload-or-restart which has this logic:
  Reload service if it supports it.
  If not, stop and then start instead.
  Does nothing if the service is not running.
This commit is contained in:
Matthew Saunders Brown 2023-12-20 09:35:52 -08:00
parent 80db965dbf
commit 92af4b365b
2 changed files with 3 additions and 7 deletions

View File

@ -10,9 +10,6 @@ services=(apache2 dovecot exim4 haproxy postfix)
# Cycle through each service.
for service in "${services[@]}"; do
# Check if service is active.
if systemctl --quiet is-active $service; then
# Reload service.
systemctl reload $service
fi
# Reload service if it supports it. If not, stop and then start instead. This does nothing if the service is not running.
systemctl try-reload-or-restart $service
done

View File

@ -1,6 +1,5 @@
[Unit]
Description="Monitor /var/tmp/letsencrypt/ for cert names to deploy."
After=apache2.service
[Path]
# TriggerLimitIntervalSec=60 - not available until next version of systemd (250)
@ -10,4 +9,4 @@ DirectoryNotEmpty=/var/tmp/letsencrypt
Unit=letsencrypt-deploy.service
[Install]
WantedBy=multi-user.target
WantedBy=paths.target