V
V
Victor2021-02-23 20:49:47
ubuntu
Victor, 2021-02-23 20:49:47

Why doesn't the telegram bot service start?

Good afternoon!
I created my own telegram bot to control arduinos.
The first version ran normally as a service.
Now updated Ubuntu, updated the code (for more functionality) and the service stopped starting.
If you manually start it (it doesn’t matter which user it is, it starts and works fine.
As a service, it doesn’t start.

File for the service:

[Unit]
Description=Service for Telegram bot main. From user telebot
After=network.target
# Для запуска сервиса нужен запущенный сервис MySQL (т.к. работаем с базой данных, расположенной на этом же сервере)
After=mysql.service
Requires=mysql.service

[Install]
WantedBy=multi-user.target

[Service]
# Даем знать systemd, что этот сервис представляет из себя лишь 1 процесс.
# Ожидается, что процесс, настроенный с помощью ExecStart= является основным процессом службы
Type=simple
# Устанавливаем рабочую дирректорию службы
WorkingDirectory=/home/telebot/bot_prod/
# Указаываем пользователя и группу для работы службы
User=telebot
Group=telebot
# Должна ли служба считаться активной, даже если все ее процессы завершены
RemainAfterExit=no
# Выполнить эту команду при запуске сервиса.
ExecStart=/home/telebot/bot_prod/bot.py
# Говорим, что нужно перезапускать сервис, если вдруг он умер
Restart=on-failure
# Таймаут на включение и выключение
TimeoutSec=60


If you try to run it, it won't run.
This is what syslog outputs in the log:
Feb 23 20:39:19 telebot systemd[2447]: telebot.service: Failed to execute command: No such file or directory
Feb 23 20:39:19 telebot systemd[2447]: telebot.service: Failed at step EXEC spawning /home/telebot/bot_prod/bot.py: No such file or directory
Feb 23 20:39:19 telebot systemd[1]: telebot.service: Main process exited, code=exited, status=203/EXEC
Feb 23 20:39:19 telebot systemd[1]: telebot.service: Failed with result 'exit-code'.
Feb 23 20:39:19 telebot systemd[1]: telebot.service: Scheduled restart job, restart counter is at 5.
Feb 23 20:39:19 telebot systemd[1]: Stopped Service for Telegram bot main. From user telebot.
Feb 23 20:39:19 telebot systemd[1]: telebot.service: Start request repeated too quickly.
Feb 23 20:39:19 telebot systemd[1]: telebot.service: Failed with result 'exit-code'.
Feb 23 20:39:19 telebot systemd[1]: Failed to start Service for Telegram bot main. From user telebot.


file /home/telebot/bot_prod/bot.py exists, permissions - 777, owner - telebot

The bot code itself, if necessary, can be viewed on github

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Karbivnichy, 2021-02-23
@Victor_M

ExecStart=/path/to/python /home/telebot/bot_prod/bot.py

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question