Running as a Service
OpenShrimp includes a built-in installer that registers the bot with whatever your platform uses to start things when nobody is at a terminal: a systemd user service on Linux, a launchd user agent on macOS, or a logon task on Windows.
The terminal setup wizard offers this at the end, so a fresh install usually needs nothing on this page. openshrimp install is how you turn it on later, or change your mind.
Automatic installation
Section titled “Automatic installation”openshrimp installThis will:
- Check that the config file exists and loads
- Detect your platform
- Find the
openshrimpexecutable - Register the bot — a unit file, an agent, or a logon task
- Start it now, except on Windows, where the task runs at your next sign-in
- On Linux, enable login lingering (so the service runs without an active login session)
Where the registration lands:
| Platform | Location |
|---|---|
| Linux | ~/.config/systemd/user/open-shrimp.service |
| macOS | ~/Library/LaunchAgents/com.openshrimp.bot.plist |
| Windows | a Task Scheduler logon task named OpenShrimp |
Set up the bot first
Section titled “Set up the bot first”openshrimp install refuses to install anything unless it finds a config file the bot can actually load. The service restarts the bot on failure, so a bot that cannot start is a bot that restarts forever — which looks, from the outside, like a machine doing nothing and saying nothing. Run openshrimp and complete the setup wizard first.
Manual installation (Linux)
Section titled “Manual installation (Linux)”If you prefer to create the service file manually:
[Unit]Description=OpenShrimp Telegram BotAfter=network-online.targetWants=network-online.target
[Service]Type=simpleExecStart=/path/to/openshrimp --config /home/you/.config/openshrimp/config.yamlRestart=on-failureRestartSec=5Environment=ANTHROPIC_API_KEY=sk-ant-...
[Install]WantedBy=default.targetSave this to ~/.config/systemd/user/open-shrimp.service, then:
systemctl --user daemon-reloadsystemctl --user enable open-shrimpsystemctl --user start open-shrimpUsing an environment file
Section titled “Using an environment file”Instead of putting the API key directly in the unit file, you can use an environment file:
echo 'ANTHROPIC_API_KEY=sk-ant-...' > ~/.config/openshrimp/.envchmod 600 ~/.config/openshrimp/.envThen add to the [Service] section:
EnvironmentFile=/home/you/.config/openshrimp/.envLogin lingering
Section titled “Login lingering”By default, systemd user services stop when you log out. Enable lingering to keep the service running:
loginctl enable-lingerThe automatic installer does this for you.
Useful commands (Linux)
Section titled “Useful commands (Linux)”systemctl --user status open-shrimp # check statusjournalctl --user -u open-shrimp -f # follow logssystemctl --user restart open-shrimp # restartsystemctl --user stop open-shrimp # stopmacOS (launchd)
Section titled “macOS (launchd)”On macOS, openshrimp install creates a launchd user agent at ~/Library/LaunchAgents/com.openshrimp.bot.plist. Logs are written to ~/Library/Logs/OpenShrimp/.
launchctl list | grep com.openshrimp # check statustail -f ~/Library/Logs/OpenShrimp/openshrimp.stderr.log # follow logsAn agent the setup wizard registered has not been loaded yet — it is registered for your next login, so that it does not start a second bot alongside the one already running. launchctl list shows nothing for it until then, which is expected and not a failed install.
Windows (logon task)
Section titled “Windows (logon task)”On Windows, openshrimp install registers a Task Scheduler logon task that starts the bot when you sign in. The task is named OpenShrimp, or OpenShrimp-<name> if your config sets an instance_name.
schtasks /Query /TN OpenShrimp # check statusschtasks /Run /TN OpenShrimp # start it nowThe tray app registers its own task under the same name, so if a task of that name already exists the installer asks before replacing it — and refuses rather than replacing it when there is no terminal to ask at.
Uninstalling
Section titled “Uninstalling”openshrimp uninstallThis removes whatever was registered — the unit file, the agent, or the logon task. On Linux and macOS the running bot is stopped as well; on Windows, deleting the task means nothing starts at your next sign-in, but a bot that is already running keeps running.