Behavior when caddy is already running with the same caddyfile (linux)

If caddy is already running with the same caddyfile I get:
Activating privacy features… done.
2017/02/05 10:28:55 listen tcp :80: bind: address already in use

I’m not familiar enough with caddy, go and linux to determine if this feature could be done or not but…

Could it be possible to change this message to something better such as one of these:

  1. Another instance of caddy is already running.
  2. Another instance of caddy is already running. Do you want to reload the configuration file? (Y/N)
    (then send a USR1 as mentioned here: https://caddyserver.com/docs/cli)

Maybe I’m missing a config that would make it more user-friendly?

Server specs: Centos 7 64bit with a non-root user

There’s not a really good cross platform way that I know of to query the list of processes and see if caddy is already running. Even if we could, it would be near impossible to know whether that instance of Caddy is what caused the error during startup…

Isn’t it best for users to handle this as best fits their system? It’s really up to you to know how you’re running Caddy and with what configuration.

In your case, perhaps you could use a small shell script - in it, you could specify a pidfile or perhaps do some quick and dirty pgrep-ing before deciding to run a new Caddy or send USR1 to an existing Caddy.

1 Like

Thanks for your answers.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.