Does taskkill allow caddy to shut down gracefully?

If i use taskkill on windows to shutdown caddy before restarting eg.

taskkill /IM caddy.exe /F

Does Caddy shutdown gracefully or will it potentially cause loss of data etc?

Some quick research indicates that /F is the flag for forceful termination, which would imply that Caddy won’t be given the opportunity to gracefully shutdown, but I could be wrong as I don’t run Caddy on Windows myself. Am interested to hear from someone who knows more about it.

I don’t know, but I do know that Caddy will gracefully shut down on Windows given an interrupt (SIGINT on Unix); but Windows doesn’t really have the concept of “Signals” AFAIK.

Any hint on how I can sent it an interrupt, or is that not a valid concept on Windows?

I can confirm that it doesnt shutdown gracefully, since any


directives are not executed.

Something I found on Google:

1 Like

@nixtren Thanks it all seems a bit more complicated than it needs to be. I think I’ll just live with the consequences of a forced shutdown.

1 Like

Hi Toby,

Indeed, looks like some complicated stuff. But it seems someone made a third-party app to do it easily:

SendSignal <pid>

You can check it here:

You just have to get Caddy’s PID and run that command (SendSignal) instead of taskkill. I don’t know how you get the PID on Windows, but on Linux you would do something like “pgrep caddy | xargs SendSignal”. Maybe you could download pgrep and xargs compiled for Windows so you could copy-paste the command I wrote :slight_smile:
Check this for running Linux commands directly on Windows:

(untested, but my logic should work. Or just search on Google how to get the PID of a process on Windows)

If you start caddy with the -pidfile directive it writes a file to disk with the pid of the process so I can get that.

I’ll give it a try.

1 Like