add systemd service example

This commit is contained in:
Robin Appelman 2025-11-01 17:26:53 +01:00
commit 53f5f45865
2 changed files with 17 additions and 0 deletions

View file

@ -19,6 +19,9 @@ netnsd daemon [--config <config.toml>]
Start the `netnsd` daemon, applying the configured namespace configuration and Start the `netnsd` daemon, applying the configured namespace configuration and
running any proxies. running any proxies.
See the [systemd service example](./netnsd.service) for an example of how to run
the daemon with systemd.
You can tell the daemon to reload the configuration with `pkill -sighup netnsd`. You can tell the daemon to reload the configuration with `pkill -sighup netnsd`.
Note that, to minimize interruption of anything using the namespaces, stopping Note that, to minimize interruption of anything using the namespaces, stopping

14
netnsd.service Normal file
View file

@ -0,0 +1,14 @@
[Unit]
Before=network.target
[Service]
# Set the log level
Environment="RUST_LOG=info"
ExecStart=/usr/bin/netnsd daemon
Restart=on-failure
# Tell systemd to send SIGUP when reloading the service instead of restarting the process.
# This lets the user reload the config without interrupting any open forwarded connections.
Type=notify-reload
[Install]
WantedBy=multi-user.target