首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >单元x.service未正确加载:参数无效

单元x.service未正确加载:参数无效
EN

Stack Overflow用户
提问于 2018-01-25 01:05:21
回答 1查看 5K关注 0票数 1

我试着使用systemd让我的Discord机器人在我的VPS上运行。我使用与我的旧机器人完全相同的设置,但是当我修改ExecStart时,我得到了一个错误

旧设置:

代码语言:javascript
复制
[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

新设置:

代码语言:javascript
复制
[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是从源代码安装的)

我得到的是:

代码语言:javascript
复制
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

代码语言:javascript
复制
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.
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-01-28 02:16:16

您的exec start指向一个目录。删除其上的尾随/,并验证这是您在激活virtualenv的情况下使用which python时所需的python的路径

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48427980

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档