systemd Service
OpenShrimp includes a built-in installer that creates a systemd user service (Linux) or launchd agent (macOS).
Automatic installation
Section titled “Automatic installation”The easiest way to install the service:
openshrimp installThis will:
- Detect your platform (Linux or macOS)
- Find the
openshrimpexecutable - Generate and write the service file
- Enable and start the service
- Enable login lingering (so the service runs without an active login session)
The service file is written to ~/.config/systemd/user/open-shrimp.service.
Manual installation
Section titled “Manual installation”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
Section titled “Useful commands”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 logsUninstalling
Section titled “Uninstalling”openshrimp uninstallThis stops, disables, and removes the service file.