Add --headless mode (no stdin read, runs until SIGTERM/exit) + systemd/NixOS examples
ci / check (push) Successful in 2m44s
ci / check (push) Successful in 2m44s
This commit is contained in:
@@ -48,6 +48,21 @@ From a clone (`git clone https://gitea.surma.technology/surma/sausage`), the
|
||||
same commands are `nix run`, `nix run -- init`, `nix run -- run` and
|
||||
`nix run .#loop`.
|
||||
|
||||
### As a service (headless)
|
||||
|
||||
Without a terminal (systemd, a container), stdin is `/dev/null` and EOF would
|
||||
stop the world. `--headless` (or `SAUSAGE_HEADLESS=1`) turns the console
|
||||
input off: the host runs until SIGTERM/SIGINT (clean stop, exit code 0) or a
|
||||
broker `exit` request (exit code 75, so the loop starts the newest version).
|
||||
Create the world first (`init`), then run the loop:
|
||||
|
||||
```sh
|
||||
nix run git+https://gitea.surma.technology/surma/sausage#loop -- --headless my-world
|
||||
```
|
||||
|
||||
[`examples/systemd/`](examples/systemd/) has a plain systemd unit and a NixOS
|
||||
module that run exactly this.
|
||||
|
||||
In the console:
|
||||
|
||||
```text
|
||||
|
||||
Reference in New Issue
Block a user