正在尝试设置gunicorn
与一起运行systemd
。控制文件是/etc/systemd/system/gunicorn.service
测试的输出是
root@samuel-pc:~# systemctl start gunicorn
Failed to start gunicorn.service: Unit gunicorn.service is not loaded properly: Invalid argument.
See system logs and 'systemctl status gunicorn.service' for details.
root@samuel-pc:~# systemctl status gunicorn.service
● gunicorn.service - gunicorn daemon
Loaded: error (Reason: Invalid argument)
Active: inactive (dead)
Jun 29 05:13:17 samuel-pc systemd[1]: [/etc/systemd/system/gunicorn.service:9] Executable path is not absolute, ignoring: gunicorn --access-logfile - --workers 3 --bind unix:/root/revamp/revamp
Jun 29 05:13:17 samuel-pc systemd[1]: gunicorn.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jun 29 05:13:29 samuel-pc systemd[1]: [/etc/systemd/system/gunicorn.service:9] Executable path is not absolute, ignoring: gunicorn --access-logfile - --workers 3 --bind unix:/root/revamp/revamp
Jun 29 05:13:29 samuel-pc systemd[1]: gunicorn.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jun 29 05:15:45 samuel-pc systemd[1]: [/etc/systemd/system/gunicorn.service:9] Executable path is not absolute, ignoring: gunicorn --access-logfile - --workers 3 --bind unix:/root/revamp/revamp
Jun 29 05:15:45 samuel-pc systemd[1]: gunicorn.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jun 29 07:01:10 samuel-pc systemd[1]: [/etc/systemd/system/gunicorn.service:9] Executable path is not absolute, ignoring: gunicorn --access-logfile - --workers 3 --bind unix:/root/revamp/revamp
Jun 29 07:01:10 samuel-pc systemd[1]: gunicorn.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jun 29 07:01:55 samuel-pc systemd[1]: [/etc/systemd/system/gunicorn.service:9] Executable path is not absolute, ignoring: gunicorn --access-logfile - --workers 3 --bind unix:/root/revamp/revamp
Jun 29 07:01:55 samuel-pc systemd[1]: gunicorn.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
这表明错误从gunicorn服务的第9行开始,因为ExecStart
[Unit]
Description=gunicorn daemon
After=network.target
[Service]
User=root
Group=www-data
WorkingDirectory=/root/revamp
ExecStart=gunicorn --access-logfile - --workers 3 --bind unix:/root/revamp/revamp.sock revamp.wsgi:application
[Install]
WantedBy=multi-user.target
它告诉您它不需要相对路径gunicorn
可执行文件:
Executable path is not absolute, ignoring
.
您需要将其更改为您的绝对路径gunicorn
可执行文件,或者:
- 系统可执行文件:
ExecStart=/usr/local/bin/gunicorn
- 您的虚拟环境的可执行文件:
ExecStart=/path/to/venv/bin/gunicorn
你可以检查这个要点:使用 Systemd 确保 Gunicorn 在引导时启动 https://gist.github.com/marcanuy/5ae0e0ef5976aa4a10a7,用于最小的 Gunicorn systemd 服务配置文件。
希望这可以帮助!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)