- explain what you are trying to do,
I want to reload CaddyServer after changing CaddyFile without downtime.
- show what you have already tried,
I saw that I can do that with this 2 options right now:
- pkill -USR1 caddy
- ps -C caddy
PID TTY TIME CMD
1392 pts/0 00:00:00 caddy
kill -s USR1 1392
And I don’t to know if this two options if right for me and will not make any downtime. And also if there is other options I need to know about?
Both those options will trigger a graceful reload of Caddy.
You may be interested in
-pidfile, a command-line flag for Caddy that will tell it to write its process ID to the file you specify. You can then read that file to generate a
kill command, like
kill -s USR1 $(cat /path/to/pidfile).
So they both do that without downtime, right?
Correct, a graceful reload of Caddy has no downtime.
If the reload fails, Caddy will continue serving sites using the old configuration, with no interruption to service.
In case your distro comes with systemd you might as well use its path unit files. (Adjust the following paths!)
Description=Trigger a reload of Caddy on changes to its config file
; ExecStart=/usr/bin/sleep 0.1s
ExecStart=/bin/systemctl try-reload-or-restart caddy.service
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.