Skip to content

Your lightweight open-source personal agent.

docs: add systemd user service instructions to README

Rok Pergarec3e406004839c
diff --git a/README.md b/README.md
index cb751ba00..2c5cdc9b5 100644
--- a/README.md
+++ b/README.md
@@ -865,6 +865,57 @@ docker run -v ~/.nanobot:/root/.nanobot --rm nanobot agent -m "Hello!"
docker run -v ~/.nanobot:/root/.nanobot --rm nanobot status
```
+## 🐧 Linux Service
+
+Run the gateway as a systemd user service so it starts automatically and restarts on failure. Below example is for a
+`pip` based installation.
+
+**1. Create the service file** at `~/.config/systemd/user/nanobot-gateway.service`:
+
+```ini
+[Unit]
+Description=Nanobot Gateway
+After=network.target
+
+[Service]
+Type=simple
+ExecStart=%h/.local/bin/nanobot gateway
+Restart=always
+RestartSec=10
+NoNewPrivileges=yes
+ProtectSystem=strict
+ReadWritePaths=%h
+
+[Install]
+WantedBy=default.target
+```
+
+**2. Enable and start:**
+
+```bash
+systemctl --user daemon-reload
+systemctl --user enable --now nanobot-gateway
+```
+
+**After config changes**, restart:
+
+```bash
+systemctl --user restart nanobot-gateway
+```
+
+If you modify the `.service` file itself, reload the unit before restarting:
+
+```bash
+systemctl --user daemon-reload
+systemctl --user restart nanobot-gateway
+```
+
+> **Note:** By default, user services only run while you are logged in. To keep the gateway running after you log out, enable lingering:
+>
+> ```bash
+> loginctl enable-linger $USER
+> ```
+
## 📁 Project Structure
```