Run as a service¶
This page covers running Telegram Commander as a systemd service. For a step-by-step first run in the terminal, see Run in CLI.
systemd (root)¶
Create the unit file yourself, for example /etc/systemd/system/telegram-commander.service:
This example runs every button as root
/etc/systemd/system/telegram-commander.service
[Unit]
Description=telegram-commander Telegram bot
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=/path/to/telegram-commander run --config /path/to/configfile.yaml
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
With no User= line, the service starts as root, so every command in your
menu has full rights on the machine. Add User=someone to the [Service]
section if your buttons do not need that much power.
Replace the placeholder paths, then:
Load and start the service
Changes to the config need a restart
The service keeps the bot running, but it reads your
config file once at start. Run
sudo systemctl restart telegram-commander after you edit it.
Related pages¶
- Run in CLI — explained first run
- Configuration — the config file
- CLI —
run,validate, and more