systemd Service (Linux user)¶
This project ships a user systemd unit template in systemd/opencode-telegram-bridge.service.
On macOS, use the launchd guide instead.
Recommended: setup wizard¶
opencode-telegram-bridge setup
This is the recommended and supported path. It writes the correct systemd unit and env file for your machine (including the right Node/CLI paths), and starts the service for you.
The wizard can optionally install a user service for opencode serve as well.
Advanced: manual install¶
Only use this if you cannot run the wizard. It is easy to misconfigure paths or environment values and end up with a service that does not start. 1. Install the package:
npm install -g opencode-telegram-bridge
- Locate the installed package so you can copy the bundled systemd files:
npm root -g
This prints a path like /usr/local/lib/node_modules or ~/.nvm/versions/node/v20.x/lib/node_modules.
The systemd files live at:
<npm root -g>/opencode-telegram-bridge/systemd/
- Copy the service and env files:
mkdir -p ~/.config/systemd/user
mkdir -p ~/.config/opencode-telegram-bridge
cp "$(npm root -g)/opencode-telegram-bridge/systemd/opencode-telegram-bridge.service" \
~/.config/systemd/user/opencode-telegram-bridge.service
cp "$(npm root -g)/opencode-telegram-bridge/systemd/opencode-telegram-bridge.env.example" \
~/.config/opencode-telegram-bridge/opencode-telegram-bridge.env
- Edit the env file:
nano ~/.config/opencode-telegram-bridge/opencode-telegram-bridge.env
-
Set the correct ExecStart path in the service file:
-
The default is
ExecStart=/usr/bin/opencode-telegram-bridge. - Replace it with the output of:
command -v opencode-telegram-bridge
- Enable and start:
systemctl --user daemon-reload
systemctl --user enable --now opencode-telegram-bridge
Start on boot (optional)¶
User services normally start on login. To run on boot without a login session:
sudo loginctl enable-linger $(whoami)
Logs¶
journalctl --user -u opencode-telegram-bridge -f