В
/etc/systemd/system
кладу файл
vkbot.service
см. ниже.
[Unit]
Description=VK_BOT
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/vkbot/bot.py
Restart=always
[Install]
WantedBy=multi-user.target
После чего в консоль (PuTTy) ввожу такие команды.
-
systemctl daemon-reload
-
systemctl enable vkbot.service
ответ :
Created symlink /etc/systemd/system/multi-user.target.wants/vkbot.service → /etc/systemd/system/vkbot.service
-
systemctl start vkbot
-
systemctl status vkbot
ответ :
● vkbot.service - VK_BOT
Loaded: loaded (/etc/systemd/system/vkbot.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2019-12-01 10:58:21 UTC; 17s ago
Process: 32463 ExecStart=/usr/local/bin/vkbot/bot.py (code=exited, status=203/EXEC)
Main PID: 32463 (code=exited, status=203/EXEC)
Dec 01 10:58:21 ithater systemd[1]: Started VK_BOT.
Dec 01 10:58:21 ithater systemd[1]: vkbot.service: Main process exited, code=exited, status=203/EXEC
Dec 01 10:58:21 ithater systemd[1]: vkbot.service: Failed with result 'exit-code'.
Dec 01 10:58:21 ithater systemd[1]: vkbot.service: Service hold-off time over, scheduling restart.
Dec 01 10:58:21 ithater systemd[1]: vkbot.service: Scheduled restart job, restart counter is at 5.
Dec 01 10:58:21 ithater systemd[1]: Stopped VK_BOT.
Dec 01 10:58:21 ithater systemd[1]: vkbot.service: Start request repeated too quickly.
Dec 01 10:58:21 ithater systemd[1]: vkbot.service: Failed with result 'exit-code'.
Dec 01 10:58:21 ithater systemd[1]: Failed to start VK_BOT.
В
../var/log
в файле
syslog
следующая информация:
Dec 1 10:58:21 ithater systemd[1]: vkbot.service: Service hold-off time over, scheduling restart.
Dec 1 10:58:21 ithater systemd[1]: vkbot.service: Scheduled restart job, restart counter is at 4.
Dec 1 10:58:21 ithater systemd[1]: Stopped VK_BOT.
Dec 1 10:58:21 ithater systemd[1]: Started VK_BOT.
Dec 1 10:58:21 ithater systemd[32463]: vkbot.service: Failed to execute command: No such file or directory
Dec 1 10:58:21 ithater systemd[32463]: vkbot.service: Failed at step EXEC spawning /usr/local/bin/vkbot/bot.py: No such file or directory
Dec 1 10:58:21 ithater systemd[1]: vkbot.service: Main process exited, code=exited, status=203/EXEC
Dec 1 10:58:21 ithater systemd[1]: vkbot.service: Failed with result 'exit-code'.
Dec 1 10:58:21 ithater systemd[1]: vkbot.service: Service hold-off time over, scheduling restart.
Dec 1 10:58:21 ithater systemd[1]: vkbot.service: Scheduled restart job, restart counter is at 5.
Dec 1 10:58:21 ithater systemd[1]: Stopped VK_BOT.
Dec 1 10:58:21 ithater systemd[1]: vkbot.service: Start request repeated too quickly.
Dec 1 10:58:21 ithater systemd[1]: vkbot.service: Failed with result 'exit-code'.
Dec 1 10:58:21 ithater systemd[1]: Failed to start VK_BOT.
Из 5 строки видим
Failed to execute command: No such file or directory
Но файл там лежит.
Вот он:
В чем же проблема?)
P.S. OS - Ubuntu 18.04