mirror of
https://github.com/caddyserver/website.git
synced 2025-04-22 04:56:17 -04:00
running: How to auto-restart caddy with systemd (#284)
It was decided in https://github.com/caddyserver/dist/pull/92 that the best way to auto restart caddy is using a systemd override file and this documents how to do that.
This commit is contained in:
parent
a2742d8d8d
commit
54af42121f
1 changed files with 9 additions and 0 deletions
|
@ -136,6 +136,15 @@ ExecReload=
|
|||
ExecReload=/usr/bin/caddy reload --config /etc/caddy/caddy.json
|
||||
```
|
||||
|
||||
Or, for example, if you'd like caddy to restart itself after 5s if it ever crashes unexpectedly:
|
||||
```systemd
|
||||
[Service]
|
||||
# Automatically restart caddy if it crashes except if the exit code was 1
|
||||
RestartPreventExitStatus=1
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
```
|
||||
|
||||
Then, save the file and exit the text editor, and restart the service for it to take effect:
|
||||
<pre><code class="cmd bash">sudo systemctl restart caddy</code></pre>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue