Answer the question
In order to leave comments, you need to log in
How to properly add a service to systemd with python bot on CentOS?
Hi all! During the holidays, I try to take my first steps in telegram bots. I want to run my bot on a virtual machine. I found a method to start a bot as a separate service in Linux, write a config file and get an error. The service does not start.
Here is the bot.service file config:
[Unit]
Description=Telegram bot 'TEST'
After=syslog.target
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/root/Downloads/bot/
ExecStart=/root/Downloads/bot/env/bin /python3 /root/Downloads/bot/main.py
RestartSec=10
Restart=always
[Install]
WantedBy=multi-user.target
bot.service - Telegram bot 'TEST'
Loaded: loaded (/etc/systemd/system/bot.service; enabled; vendor preset: disabled)
Active: activating (auto-restart) (Result: exit-code) since Thu 2021- 06-03 22:51:09 +05; 651ms ago
Process: 9504 ExecStart=/root/Downloads/bot/env/bin/python3 /root/Downloads/bot/main.py (code=exited, status=1/FAILURE)
Main PID: 9504 (code=exited, status =1/FAILURE)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question