Complete command-line interface reference for Zentinel.
Synopsis
zentinel [OPTIONS] [COMMAND]
Global Options
| Option | Short | Environment | Description |
|---|---|---|---|
--config <FILE> | -c | ZENTINEL_CONFIG | Configuration file path |
--test | -t | Test configuration and exit | |
--verbose | Enable debug logging | ||
--daemon | -d | Run as background daemon | |
--upgrade | -u | Upgrade from running instance | |
--version | -V | Print version information | |
--help | -h | Print help information |
Commands
run (default)
Run the proxy server. This is the default command when none is specified.
# These are equivalent
zentinel --config zentinel.kdl
zentinel run --config zentinel.kdl
Options:
-c, --config <FILE>- Configuration file path
test
Validate configuration file and exit without starting the server.
zentinel test --config zentinel.kdl
zentinel -t -c zentinel.kdl
Options:
-c, --config <FILE>- Configuration file to test
Exit codes:
0- Configuration is valid1- Configuration error
Output:
INFO Testing configuration file: zentinel.kdl
INFO Configuration test successful:
INFO - 2 listener(s)
INFO - 5 route(s)
INFO - 3 upstream(s)
zentinel: configuration file zentinel.kdl test is successful
Examples
Basic Usage
# Start with configuration file
zentinel --config /etc/zentinel/zentinel.kdl
# Start with environment variable
export ZENTINEL_CONFIG=/etc/zentinel/zentinel.kdl
zentinel
# Use embedded default configuration
zentinel
Configuration Testing
# Test configuration syntax and semantics
zentinel --test --config zentinel.kdl
# Test with verbose output
zentinel --test --verbose --config zentinel.kdl
Daemon Mode
# Run as daemon (background process)
zentinel --daemon --config zentinel.kdl
# Upgrade running instance (zero-downtime restart)
zentinel --upgrade --config zentinel.kdl
Debug Mode
# Enable debug logging
zentinel --verbose --config zentinel.kdl
# Or via environment variable
RUST_LOG=debug zentinel --config zentinel.kdl
Version Information
zentinel --version
Output:
zentinel 0.1.0 (release 2025.01, commit abc1234)
Version string includes:
- Semantic version (Cargo.toml)
- CalVer release tag
- Git commit hash
Configuration Resolution
Zentinel resolves configuration in this order (first found wins):
--config/-ccommand-line argumentZENTINEL_CONFIGenvironment variable- Embedded default configuration
Process Management
Signals
| Signal | Behavior |
|---|---|
SIGTERM | Graceful shutdown (drain connections) |
SIGINT | Graceful shutdown (Ctrl+C) |
SIGHUP | Reload configuration |
Graceful Shutdown
On SIGTERM/SIGINT:
- Stop accepting new connections
- Drain in-flight requests (configurable timeout)
- Close remaining connections
- Exit with code 0
# Graceful shutdown
kill -TERM $(cat /var/run/zentinel.pid)
# Force shutdown (after graceful timeout)
kill -9 $(cat /var/run/zentinel.pid)
Configuration Reload
# Reload configuration without restart
kill -HUP $(cat /var/run/zentinel.pid)
Reload behavior:
- Parse new configuration
- Validate syntax and semantics
- If valid: atomically swap configuration
- If invalid: keep old configuration, log error
Zero-Downtime Upgrade
# Start new instance that takes over from old
zentinel --upgrade --config zentinel.kdl
Upgrade sequence:
- New process starts
- New process signals old process
- Old process transfers listening sockets
- Old process drains connections
- Old process exits
Exit Codes
| Code | Description |
|---|---|
0 | Success / clean shutdown |
1 | Configuration error |
2 | Runtime error |
See Also
- Environment Variables - Environment variable reference
- Configuration - Configuration file format