且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

有没有办法自动重新加载主管进程?

更新时间:2023-02-25 14:34:12

您应该能够使用 事件监听器,它监视文件系统(可能带有 watchdog>) 并使用 XML-RPC API 发出重新启动.从 superlancememmon 侦听器/a> 灵感包.它不需要那么复杂.由于看门狗会调用您的重启例程,您无需使用 childutils.listener.wait 读取事件.

You should be able to use an Event Listener which monitors the filesystem (with perhaps watchdog) and emits a restart using the XML-RPC API. Check out the memmon listener from the superlance package for inspiration. It wouldn't need to be that complicated. And since the watchdog would call your restart routine you don't need to read the events using childutils.listener.wait.

或者,如果要访问的 supervisord API 的权限正确(套接字权限、HTTP 密码),git 钩子可能会起作用.一种更简单但安全性较低的方法.

Alternatively, git hooks might do the trick if the permissions are correct for the supervisord API to be accessed (socket permissions, HTTP passwords). A simpler but less-secure approach.

一种更简单甚至更不安全的方法是允许您发出supervisorctl restart.运行用户必须匹配您的推送用户(或 git 或 www,具体取决于您的设置方式).有很多方法可以让它在安全方面出错.但是对于开发来说,可能还不错.

A simpler and even less-secure approach would be to allow you to issue a supervisorctl restart. The running user has to match your push user (or git, or www, depending on how you have it setup). Lot's of ways to have it go wrong security-wise. But for development, might do fine.

相关: