mirror of
https://github.com/caddyserver/website.git
synced 2025-04-21 20:46:15 -04:00
cli: Add signal and exit code docs
Also minor tweak to config comparison table
This commit is contained in:
parent
7819a84e59
commit
6ccb6fff21
2 changed files with 36 additions and 2 deletions
|
@ -80,7 +80,11 @@ The ellipses `...` indicates a continuation, i.e. one or more parameters.
|
|||
- **[caddy version](#caddy-version)**
|
||||
Prints the version
|
||||
|
||||
- **[Signals](#signals)**
|
||||
How Caddy handles signals
|
||||
|
||||
- **[Exit codes](#exit-codes)**
|
||||
Emitted when the Caddy process exits
|
||||
|
||||
## Subcommands
|
||||
|
||||
|
@ -444,3 +448,33 @@ Validates a configuration file, then exits. This command deserializes the config
|
|||
<pre><code class="cmd bash">caddy version</code></pre>
|
||||
|
||||
Prints the version and exits.
|
||||
|
||||
|
||||
|
||||
## Signals
|
||||
|
||||
Caddy traps certain signals and ignores others. Signals can initiate specific process behavior.
|
||||
|
||||
Signal | Behavior
|
||||
-------|----------
|
||||
`SIGINT` | Graceful exit. Send signal again to force exit immediately.
|
||||
`SIGQUIT` | Quits Caddy immediately, but still cleans up locks in storage because it is important.
|
||||
`SIGTERM` | Graceful exit.
|
||||
`SIGUSR1` | Ignored. For config updates, use the `caddy reload` command or [the API](/docs/api).
|
||||
`SIGUSR2` | Ignored.
|
||||
`SIGHUP` | Ignored.
|
||||
|
||||
A graceful exit means that new connections are no longer accepted, and existing connections will be drained before the socket is closed. A grace period may apply (and is configurable). Once the grace period is up, connections will be forcefully terminated. Locks in storage and other resources that individual modules need to release are cleaned up during a graceful shutdown.
|
||||
|
||||
## Exit codes
|
||||
|
||||
Caddy returns a code when the process exits:
|
||||
|
||||
Code | Meaning
|
||||
-----|---------
|
||||
`0` | Normal exit.
|
||||
`1` | Failed startup. **Do not automatically restart the process; it will likely error again unless changes are made.**
|
||||
`2` | Forced quit. Caddy was forced to exit without cleaning up resources.
|
||||
`3` | Failed quit. Caddy exited with some errors during cleanup.
|
||||
|
||||
In bash, you can get the exit code of the last command with `echo $?`.
|
|
@ -177,10 +177,10 @@ The Caddyfile seems easier than JSON, but should you always use it? There are pr
|
|||
|
||||
JSON | Caddyfile
|
||||
-----|----------
|
||||
Full range of Caddy functionality | Most common parts of Caddy functionality
|
||||
Easy to generate | Easy to craft by hand
|
||||
Easily programmable | Difficult to automate
|
||||
Easily programmable | Awkward to automate
|
||||
Extremely expressive | Moderately expressive
|
||||
Full range of Caddy functionality | Most of Caddy functionality
|
||||
Allows config traversal | Cannot traverse within Caddyfile
|
||||
Partial config changes | Whole config changes only
|
||||
Can be exported | Cannot be exported
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue