I
I
Ivan Yakushenko2019-05-03 13:46:47
ubuntu
Ivan Yakushenko, 2019-05-03 13:46:47

Why is the script not running through systemd?

Ubuntu 18.04.
/etc/systemd/system/start_bot.service:

[Unit]
Description=VkImageBot
After=multi-user.target

[Service]
Type=idle
ExecStart=/usr/bin/python3 /home/ftproot/vk_image_bot.py
Restart=always

[Install]
WantedBy=multi-user.target

After doing sudo systemctl start sitbot.service nothing, sudo systemctl status sitbot.service:
● start_bot.service - VkImageBot
   Loaded: loaded (/etc/systemd/system/start_bot.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2019-05-03 12:44:51 CEST; 1s ago
  Process: 28107 ExecStart=/usr/bin/python3 /home/ftproot/vk_image_bot/start_bot.py (code=exited, status=1/FAILUR
 Main PID: 28107 (code=exited, status=1/FAILURE)

May 03 12:44:51 shostvo100vkbot.tk systemd[1]: start_bot.service: Main process exited, code=exited, status=1/FAIL
May 03 12:44:51 shostvo100vkbot.tk systemd[1]: start_bot.service: Failed with result 'exit-code'.
May 03 12:44:51 shostvo100vkbot.tk systemd[1]: start_bot.service: Service hold-off time over, scheduling restart.
May 03 12:44:51 shostvo100vkbot.tk systemd[1]: start_bot.service: Scheduled restart job, restart counter is at 5.
May 03 12:44:51 shostvo100vkbot.tk systemd[1]: Stopped VkImageBot.
May 03 12:44:51 shostvo100vkbot.tk systemd[1]: start_bot.service: Start request repeated too quickly.
May 03 12:44:51 shostvo100vkbot.tk systemd[1]: start_bot.service: Failed with result 'exit-code'.
May 03 12:44:51 shostvo100vkbot.tk systemd[1]: Failed to start VkImageBot.
lines 1-14/14 (END)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
pcdesign, 2019-05-03
@kshnkvn

To defeat this line
Can add:

Restart=always
RestartSec=15

And about why the Python script itself crashes - it's worth logging the error somewhere to a file.

P
pfg21, 2019-05-03
@pfg21

data is not enough.
see what vk_image_bot.py doesn't like, that it terminates and throws out status 1.
maybe the user is not suitable, maybe something else ...
cram more informational messages into vk_image_bot.py. otherwise debugging a dumb program is worse than sex with a cold woman ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question