Skip to content

service

snippbot start runs the server in the foreground. To keep it running across reboots and restart it if it crashes, run it under your operating system’s process supervisor. snippbot service installs a user-level service that does this — without elevation. On Linux/macOS no root/sudo is required; on Windows it installs a per-user Startup-folder launcher that starts the daemon hidden at logon, so no Administrator rights are needed either.

It picks the right mechanism for your platform automatically:

OSMechanismLocation
Linuxsystemd user unit~/.config/systemd/user/snippbot.service
macOSlaunchd LaunchAgent~/Library/LaunchAgents/com.snippbot.daemon.plist
Windowsper-user Startup-folder launcher (hidden)%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\Snippbot.vbs
Terminal window
snippbot service install # install + start, defaults host 127.0.0.1 port 18781
snippbot service install --host 0.0.0.0 --port 18781 # expose on the network
snippbot service install --data-dir /srv/snippbot # pin SNIPPBOT_DATA_DIR
snippbot service install --env SNIPPBOT_SWARM_ENABLED=1 --env FOO=bar # bake env into the unit
snippbot service status # show whether it's running
snippbot service start # start it (after a `stop`)
snippbot service stop # stop it — stays stopped until `start` or next login
snippbot service restart # restart it (picks up upgraded code)
snippbot service uninstall # stop + remove

Lifecycle: always go through the supervisor

Section titled “Lifecycle: always go through the supervisor”

Once installed, the OS supervisor owns the daemon. It restarts it on crash (KeepAlive / Restart=always) and on login. That means kill <pid> or snippbot stop only makes the supervisor relaunch it a second later — use snippbot service stop / restart instead. On macOS stop boots the agent out of your launchd domain (launchctl bootout) so it stays stopped; the plist remains on disk, so snippbot service start or your next login brings it back.

The supervisor starts the daemon with a minimal environment (launchd: only PATH), so environment variables from your shell never reach it. Anything the daemon should see — feature flags, SNIPPBOT_DATA_DIR, tokens — must be pinned with --env KEY=VALUE at install time (repeatable). Re-run install to change them; it rewrites the unit in place.

  • Headless Linux: run loginctl enable-linger $USER so the user service runs without an active login session.
  • Logs: systemd → journalctl --user -u snippbot; launchd → ~/.snippbot/logs/.
  • The service runs snippbot start for you, so don’t also start the daemon manually.
  • The repo’s scripts/dev.sh / START.sh detect an installed service and route the backend through snippbot service start|stop automatically.