jsjcjsjc
V2EX  ›  问与答

虚拟环境下的 uwsgi 设置开机启动并且进程守护有啥官方的方法不?

  •  
  •   jsjcjsjc · Aug 15, 2020 · 1692 views
    This topic created in 2155 days ago, the information mentioned may be changed or developed.

    自己这方面是小白鸭

    直接新建一个 sh 文件放入启动肯定不行

    #!/bin/bash
    source /data/env/typo/bin/activate
    cd /data/wwwroot/typo/
    uwsgi -x typo.xml
    

    直接用虚拟环境下的 uwsgi 执行命令靠谱吗?然后用 supervisor 进程守护?

    [program:typo]
    command=/data/env/typo/bin/uwsgi -x /data/wwwroot/typo/typo.xml
    user=root
    

    想问一下虚拟环境下的 uwsgi 设置开机启动并且进程守护有啥官方的方法不?

    感谢

    6 replies    2020-08-16 08:21:47 +08:00
    Z5460520
        1
    Z5460520  
       Aug 15, 2020
    我能说我用 docker 解决这个问题的嘛,套娃完成 nginx + uwsgi + django 开机自动启动,关机自动重启
    taolu
        2
    taolu  
       Aug 15, 2020
    可以试试通过 systemd

    [Service]
    ExecStart=/path/.venv/bin/uwsgi --ini /path/uwsgi.ini
    ExecReload=/path/.venv/bin/uwsgi --reload /path/uwsgi.pid
    ExecStop=/path/.venv/bin/uwsgi --stop /path/uwsgi.pid
    Type=simple
    jsjcjsjc
        3
    jsjcjsjc  
    OP
       Aug 15, 2020
    @taolu 感谢鸭
    不过和 uwsgi -x typo.xml 没有关系吗?
    renmu123
        4
    renmu123  
       Aug 15, 2020 via Android
    我觉得挺靠谱的,就是 supervisor 不一定能开机自启
    taolu
        5
    taolu  
       Aug 15, 2020
    @jsjcjsjc #3 一样的呀,只是配置文件格式不同`uwsgi --xml typo.xml`
    jsjcjsjc
        6
    jsjcjsjc  
    OP
       Aug 16, 2020
    @taolu 好的,感谢,就怕 uwsgi 不知道 typo.xml 在哪
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3564 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 04:49 · PVG 12:49 · LAX 21:49 · JFK 00:49
    ♥ Do have faith in what you're doing.