eljojo / telegram_bot

A charismatic Ruby client for Telegram's Bot API
MIT License
298 stars 82 forks source link

Multiple bots on the same machine, is it possible? #51

Open yuvalinc opened 4 years ago

yuvalinc commented 4 years ago

Hi @eljojo I'm looking for the easiest way to run several bots on the same machine,

Is it possible? if it does, can you show provide an example?

Really appreciate your hard work, Thanks, Yuval.

Rubueno commented 4 years ago

Yes, it's possible to do. Run the bots with systemd. I run it like this:

[Unit]
Description=Botname Daemon
After=syslog.target network.target

[Service]
User=bot
Group=bot
Type=simple
WorkingDirectory=/path/to/bot
ExecStart=/usr/bin/bash -lc "bundle exec bot.rb"
Restart=always
RestartSec=2
TimeoutStopSec=20

[Install]
WantedBy=multi-user.target