首页 新闻 会员 周边 捐助

systemctl start gunicorn服务启动失败

0
悬赏园豆:5 [已解决问题] 解决于 2019-06-20 18:38
# 项目地址
/home/crime/sites/demo.eosones.com/Myblog
# 虚拟环境
/home/crime/sites/demo.eosones.com/Myblog_env

配置代码

# vim /etc/systemd/system/gunicorn.service

[Unit]
Description=gunicorn daemon
After=network.target

[Service]
User=root
Group=www-data
WorkingDirectory=/home/crime/sites/demo.eosones.com/Myblog
ExecStart=/home/crime/sites/demo.eosones.com/Myblog_env/bin/gunicorn --workers 3 --bind 127.0.0.1:8080 Myblog.wsgi:application

[Install]
WantedBy=multi-user.target

报错信息

Jun 20 17:49:09 VM_0_5_centos systemd[1]: Started gunicorn daemon.
Jun 20 17:49:09 VM_0_5_centos systemd[1]: gunicorn.service: main process exited, code=exited, status=216/GROUP
Jun 20 17:49:09 VM_0_5_centos systemd[1]: Unit gunicorn.service entered failed state.
Jun 20 17:49:09 VM_0_5_centos systemd[1]: gunicorn.service failed.

小白刚接触Linux,求大佬帮忙到底是哪里出错了,直接在虚拟环境中gunicorn --workers 3 --bind 127.0.0.1:8080 Myblog.wsgi:application可以成功启动,添加到systemd就失败。

CRIME的主页 CRIME | 初学一级 | 园豆:3
提问于:2019-06-20 17:55
< >
分享
最佳答案
0

journalctl -u gunicorn.service看一下错误日志

收获园豆:5
dudu | 高人七级 |园豆:29294 | 2019-06-20 17:58
Jun 20 17:48:44 VM_0_5_centos systemd[1]: Started gunicorn daemon.
Jun 20 17:48:44 VM_0_5_centos systemd[1]: gunicorn.service: main process exited, code=exited, status=216/GROUP
Jun 20 17:48:44 VM_0_5_centos systemd[1]: Unit gunicorn.service entered failed state.
Jun 20 17:48:44 VM_0_5_centos systemd[1]: gunicorn.service failed.
Jun 20 17:49:09 VM_0_5_centos systemd[1]: Started gunicorn daemon.
Jun 20 17:49:09 VM_0_5_centos systemd[1]: gunicorn.service: main process exited, code=exited, status=216/GROUP
Jun 20 17:49:09 VM_0_5_centos systemd[1]: Unit gunicorn.service entered failed state.
Jun 20 17:49:09 VM_0_5_centos systemd[1]: gunicorn.service failed.

错误日志中都是这个报错信息

CRIME | 园豆:3 (初学一级) | 2019-06-20 18:21

@CRIME: 可能是 Group=www-data 引起的,试试改为 Group=root

dudu | 园豆:29294 (高人七级) | 2019-06-20 18:27

@dudu: 感谢大佬,可以了

CRIME | 园豆:3 (初学一级) | 2019-06-20 18:38
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册