我试着使用systemd让我的Discord机器人在我的VPS上运行。我使用与我的旧机器人完全相同的设置,但是当我修改ExecStart时,我得到了一个错误
旧设置:
[Unit]
Description=Red-DiscordBotV3
After=multi-user.target
[Service]
WorkingDirectory=/home/laggron/rewrite/lib/python3.6/site-packages/redbot
User=laggron
Group=laggron
ExecStart=/usr/bin/python3.5 /home/username/Red-DiscordBot/red.py --no-prompt
Type=idle
Restart=always
RestartSec=15
[Install]
WantedBy=multi-user.target新设置:
[Unit]
Description=Red-DiscordBotV3
After=multi-user.target
[Service]
WorkingDirectory=/home/laggron/rewrite/lib/python3.6/site-packages/redbot
User=laggron
Group=laggron
ExecStart=/home/laggron/rewrite/lib/python3.6/ -m redbot Red --dev --no-prompt
Type=idle
Restart=always
RestartSec=15
[Install]
WantedBy=multi-user.target(新安装使用的是virtualenv,python3.6是从源代码安装的)
我得到的是:
danny_brown5544@ref:/etc/systemd/system $
Failed to start redV3.service: Unit redV3.service is not loaded properly: Invalid argument.
See system logs and 'systemctl status redV3.service' for details.键入systemctl status redV3.service
danny_brown5544@ref:/home/danny_brown5544/Red-DiscordBot $
● redV3.service - Red-DiscordBotV3
Loaded: error (Reason: Invalid argument)
Active: inactive (dead)
Jan 21 11:04:55 ref systemd[1]: [/etc/systemd/system/redV3.service:8] Executable path specifies a directory, ignoring: /home/laggron/rewrite/lib/python3.6/ /home/laggron/rewrite/lib/python3.6/site-packages/redbot/__main__.py Red --dev --no-prompt
Jan 21 11:04:55 ref systemd[1]: redV3.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jan 21 11:06:12 ref systemd[1]: [/etc/systemd/system/redV3.service:8] Executable path specifies a directory, ignoring: /home/laggron/rewrite/lib/python3.6/ /home/laggron/rewrite/lib/python3.6/site-packages/redbot/__main__.py Red --dev --no-prompt
Jan 21 11:06:12 ref systemd[1]: redV3.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jan 21 11:11:54 ref systemd[1]: [/etc/systemd/system/redV3.service:8] Executable path specifies a directory, ignoring: /home/laggron/rewrite/lib/python3.6/ /home/laggron/rewrite/lib/python3.6/site-packages/redbot/__main__.py --dev --no-prompt
Jan 21 11:11:54 ref systemd[1]: redV3.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jan 24 15:34:20 ref systemd[1]: [/etc/systemd/system/redV3.service:8] Executable path specifies a directory, ignoring: /home/laggron/rewrite/lib/python3.6/ -m redbot Red --dev --no-prompt
Jan 24 15:34:20 ref systemd[1]: redV3.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jan 24 15:35:34 ref systemd[1]: [/etc/systemd/system/redV3.service:8] Executable path specifies a directory, ignoring: /home/laggron/rewrite/lib/python3.6/ -m redbot Red --dev --no-prompt
Jan 24 15:35:34 ref systemd[1]: redV3.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.发布于 2018-01-28 02:16:16
您的exec start指向一个目录。删除其上的尾随/,并验证这是您在激活virtualenv的情况下使用which python时所需的python的路径
https://stackoverflow.com/questions/48427980
复制相似问题