V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 ·
    itgoyo · 121 天前 · 714 次点击
    这是一个创建于 121 天前的主题,其中的信息可能已经有所发展或是发生改变。
    由于电脑重启之后需要手动运行 nohub python3 main.py &

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

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

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

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

    正确答案参见楼上


    不过具体到你遇到的情况,大概在 supervisorD 给你的程序发关闭信号的时候没有处理好?
    这时候就说到 systemD 的好处了,一次不成还能事后补刀,可以确保击毙
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   885 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 20:12 · PVG 04:12 · LAX 13:12 · JFK 16:12
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.