错误:无法启用单元:参数无效

发布时间:2021-03-08 17:25

我正在尝试使用带有 Nginx 和 gunicorn 的 raspberry pi 1.0 创建一个网站。

在配置 gunicorn 时,我必须创建文件 myproject.service 但是当我尝试执行此命令时:

systemctl enable myproject

给我一​​个错误(无法启用单元:无效参数) 这两种解决方案我都无法解决 --> What does "Failed to execute operation: Invalid argument" mean when running systemctl enable?

和 --> Problems trying to enable/start custom target in systemd

但仍然给我这个错误。

etc/systemd/system/myproject.service 文件的代码是这样的:

[Unit]
Description=Gunicorn instance to serve One
After=network.target
[Service]
User=root
Group=www-data
WorkingDirectory=/var/www/html
Environment="PATH=/var/www/html/myprojectenv/bin"
ExecStart=/var/www/html/myprojectenv/bin/gunicorn --workers 3 --bind unix:myproject.sock -m 007 wsgi:app
[Install]
WantedBy=multi-user.taget

并且还给了我这些更具体的错误:

mar 08 17:18:51 justonepassword gunicorn[1623]: [2021-03-08 17:18:50 +0100] [1626] [INFO] Booting worker with pid: 1626
mar 08 17:18:51 justonepassword gunicorn[1623]: [2021-03-08 17:18:51 +0100] [1627] [INFO] Booting worker with pid: 1627
mar 08 17:32:14 justonepassword systemd[1]: /etc/systemd/system/myproject.service:1: Missing '='.
mar 08 17:33:00 justonepassword systemd[1]: /etc/systemd/system/myproject.service:1: Assignment outside of section. Ignoring.
mar 08 17:33:00 justonepassword systemd[1]: /etc/systemd/system/myproject.service:2: Assignment outside of section. Ignoring.
mar 08 17:33:00 justonepassword systemd[1]: /etc/systemd/system/myproject.service:3: Assignment outside of section. Ignoring.
mar 08 17:33:07 justonepassword systemd[1]: /etc/systemd/system/myproject.service:1: Missing '='.
mar 08 17:40:04 justonepassword systemd[1]: /etc/systemd/system/myproject.service:1: Assignment outside of section. Ignoring.
mar 08 17:40:04 justonepassword systemd[1]: /etc/systemd/system/myproject.service:2: Assignment outside of section. Ignoring.
mar 08 17:40:04 justonepassword systemd[1]: /etc/systemd/system/myproject.service:3: Assignment outside of section. Ignoring.

我试图搜索并解决这个问题,但总有一些问题

我正在尝试学习本教程 --> https://youtu.be/o2WA-A67Bks

如果您有任何帮助,我们将不胜感激

回答1

我尝试重新启动,它仍然给我错误,但它有效