如何使用Ubuntu 16.04在服务器中自动启动gunicorn

时间:2017-12-04 12:56:39

标签: python django ubuntu gunicorn

客户名称是siar,unroot这是我的想法:

  1. sudo mkdir -p /usr/lib/systemd/system

  2. sudo vim /usr/lib/systemd/system/siar.service

  3. 及其背景:

    [Unit]
    After=syslog.target network.target remote-fs.target nss-lookup.target
    [Service]
    User=siar
    WorkingDirectory=/home/siar/sites/django-blog-learning/blogproject
    ExecStart=/home/siar/sites/env/bin/gunicorn --bind unix:/tmp/siar.socket blogproject.wsgi:application
    Restart=on-failure
    [Install]
    WantedBy=multi-user.target
    
    1. sudo systemctl start siar
    2. 在这里我得到错误:

      Failed to start siar.service: Launch helper exited with unknown return code 1
      See system logs and 'systemctl status siar.service' for details.
      

      cat /var/log/syslog

      之后

      我发现错误:

      Dec  4 23:43:33 iZwz92ma406e6d08vhkwqmZ dbus[305]: [system] Activating service name='org.freedesktop.systemd1' (using servicehelper)
      Dec  4 23:43:33 iZwz92ma406e6d08vhkwqmZ dbus[305]: [system] Activated service 'org.freedesktop.systemd1' failed: Launch helper exited with unknown return code 1
      

      我试过

      systemctl status siar.service
      结果是 Failed to get properties: Launch helper exited with unknown return code 1
      我不知道它是什么意思

      并给出文件夹peimissions:

      chmod 777 /usr/lib/systemd/system  
      

      什么都没发生

      貌似,我尝试其他.service并且存在相同的错误

      现在,我可以使用start自动完成gunicorn工作,但命令systemctl仍无法启动siar.service

0 个答案:

没有答案