systemd: ensure unix socket is removed on ungraceful shutdown

Caddy chokes if it dies or systemd timeout kills the process ungracefully as it
can't deal with a left over unix file socket.
Ensure the unit always deletes the socket as a post exit cleanup strategy.
This commit is contained in:
Levente Polyak
2021-02-13 16:14:45 +00:00
parent f87a41a2de
commit 3415690be9
2 changed files with 2 additions and 1 deletions

View File

@ -29,6 +29,7 @@ Environment=XDG_CONFIG_HOME=/etc
ExecStartPre=/usr/bin/caddy validate --config /etc/caddy/Caddyfile
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile
ExecStopPost=/usr/bin/rm -f /run/caddy/admin.socket
# Do not allow the process to be restarted in a tight loop. If the
# process fails to start, something critical needs to be fixed.