From 3e406004839ccb2590649736e2e1c8c93761161c Mon Sep 17 00:00:00 2001 From: Rok Pergarec Date: Sat, 21 Feb 2026 20:55:54 +0100 Subject: [PATCH 1/2] docs: add systemd user service instructions to README --- README.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/README.md b/README.md index cb751ba..2c5cdc9 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 ``` From 1aa06ea03dcd1c0fa4eed018e822918fe938706a Mon Sep 17 00:00:00 2001 From: Re-bin Date: Sun, 22 Feb 2026 17:51:23 +0000 Subject: [PATCH 2/2] docs: improve Linux Service section in README --- README.md | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 2c5cdc9..99f9681 100644 --- a/README.md +++ b/README.md @@ -867,10 +867,15 @@ 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. +Run the gateway as a systemd user service so it starts automatically and restarts on failure. -**1. Create the service file** at `~/.config/systemd/user/nanobot-gateway.service`: +**1. Find the nanobot binary path:** + +```bash +which nanobot # e.g. /home/user/.local/bin/nanobot +``` + +**2. Create the service file** at `~/.config/systemd/user/nanobot-gateway.service` (replace `ExecStart` path if needed): ```ini [Unit] @@ -890,27 +895,24 @@ ReadWritePaths=%h WantedBy=default.target ``` -**2. Enable and start:** +**3. Enable and start:** ```bash systemctl --user daemon-reload systemctl --user enable --now nanobot-gateway ``` -**After config changes**, restart: +**Common operations:** ```bash -systemctl --user restart nanobot-gateway +systemctl --user status nanobot-gateway # check status +systemctl --user restart nanobot-gateway # restart after config changes +journalctl --user -u nanobot-gateway -f # follow logs ``` -If you modify the `.service` file itself, reload the unit before restarting: +If you edit the `.service` file itself, run `systemctl --user daemon-reload` 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: +> **Note:** User services only run while you are logged in. To keep the gateway running after logout, enable lingering: > > ```bash > loginctl enable-linger $USER