推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
itgoyo
V2EX  ›  Python

supervisor 进程管理多次执行问题询问

  •  
  •   itgoyo · Dec 28, 2023 · 3451 views
    This topic created in 1003 days ago, the information mentioned may be changed or developed.
    由于电脑重启之后需要手动运行 nohub python3 main.py &

    然后就了解到了 supervisor 这个项目,也写好了子进程自启动的.ini 配置

    但是我发现我每次 supervisorctl reread 、supervisordctl update

    发现我的 main.py 会执行两次或者是多次,这个有什么办法避免吗?还是说我用错了
    2 replies  •  2024-01-01 20:30:10 +08:00
    killva4624
        1
    killva4624  
       Dec 28, 2023
    可以看看系统自带的服务管理方案,linux 的 Systemd , windows 的 service.msc
    julyclyde
        2
    julyclyde  
       Jan 1, 2024
    选 supervisorD ,一般情况下都是错误

    错误理由:
    1 supervisorD 不能控制 非直属 的进程(缺乏 cgroup 机制)
    2 supervisorD 不能保证 自己的存活

    正确答案参见楼上


    不过具体到你遇到的情况,大概在 supervisorD 给你的程序发关闭信号的时候没有处理好?
    这时候就说到 systemD 的好处了,一次不成还能事后补刀,可以确保击毙
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1380 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 16:42 · PVG 00:42 · LAX 09:42 · JFK 12:42
    ♥ Do have faith in what you're doing.