yagop / telegram-bot

UNMAINTAINED - A Telegram Bot based on plugins
GNU General Public License v2.0
848 stars 502 forks source link

Run it as a daemon problem on Ubuntu 16.04 #409

Closed MartinzSmitt closed 7 years ago

MartinzSmitt commented 7 years ago

Hello, on ubuntu 16.04 upstart not working, please help rewrite daemon script for Systemd

Upstart script:

description "Telegram-bot upstart script"
respawn
respawn limit 15 5
start on runlevel [2345]
stop on shutdown
setuid user
exec /bin/sh /home/user/telegram-bot/launch.sh

I try write Systemd script, but its not working:

[Unit]
Description=Telegram-bot upstart script
Documentation=man:Telegram-bot(1)

Restart=on-failure
RestartSec 15 5

[Service]
Type=forking
ExecStart=/bin/sh /home/mz/telegram-bot/launch.sh

[Install]
WantedBy=multi-user.target
MartinzSmitt commented 7 years ago

All working Code:

[Unit]
Description=Telegram-Bot
After=network.target

[Service]
Type=simple
WorkingDirectory=/home/mz/telegram-bot/
ExecStart=/home/mz/telegram-bot/launch.sh
User=mz
Restart=on-failure

[Install]
WantedBy=multi-user.target