Skip to content

systemd Service

OpenShrimp includes a built-in installer that creates a systemd user service (Linux) or launchd agent (macOS).

The easiest way to install the service:

Terminal window
openshrimp install

This will:

  1. Detect your platform (Linux or macOS)
  2. Find the openshrimp executable
  3. Generate and write the service file
  4. Enable and start the service
  5. Enable login lingering (so the service runs without an active login session)

The service file is written to ~/.config/systemd/user/open-shrimp.service.

If you prefer to create the service file manually:

[Unit]
Description=OpenShrimp Telegram Bot
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=/path/to/openshrimp --config /home/you/.config/openshrimp/config.yaml
Restart=on-failure
RestartSec=5
Environment=ANTHROPIC_API_KEY=sk-ant-...
[Install]
WantedBy=default.target

Save this to ~/.config/systemd/user/open-shrimp.service, then:

Terminal window
systemctl --user daemon-reload
systemctl --user enable open-shrimp
systemctl --user start open-shrimp

Instead of putting the API key directly in the unit file, you can use an environment file:

Terminal window
echo 'ANTHROPIC_API_KEY=sk-ant-...' > ~/.config/openshrimp/.env
chmod 600 ~/.config/openshrimp/.env

Then add to the [Service] section:

EnvironmentFile=/home/you/.config/openshrimp/.env

By default, systemd user services stop when you log out. Enable lingering to keep the service running:

Terminal window
loginctl enable-linger

The automatic installer does this for you.

Terminal window
systemctl --user status open-shrimp # check status
journalctl --user -u open-shrimp -f # follow logs
systemctl --user restart open-shrimp # restart
systemctl --user stop open-shrimp # stop

On macOS, openshrimp install creates a launchd user agent at ~/Library/LaunchAgents/com.openshrimp.bot.plist. Logs are written to ~/Library/Logs/OpenShrimp/.

Terminal window
launchctl list | grep com.openshrimp # check status
tail -f ~/Library/Logs/OpenShrimp/openshrimp.stderr.log # follow logs
Terminal window
openshrimp uninstall

This stops, disables, and removes the service file.