一時的な解決策として、一つは以下の
があなたのconfファイルに以下を追加行うことができます。
; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
; Event listener, on any kid going down, restart all the children
[eventlistener:good_listener]
command=python /path/to/python_script.py
events=PROCESS_STATE
、スクリプト:これは、あなたがやりたいだろう
#!/usr/bin/python
import sys
from supervisor.childutils import listener
from subprocess import call
def write_stderr(s):
sys.stderr.write(s)
sys.stderr.flush()
def main():
while 1:
cmd_msg, cmd_body = listener.wait(sys.stdin, sys.
if 'eventname' in cmd_msg:
if cmd_msg['eventname'] == 'PROCESS_STATE_EXITED':
write_stderr('Process has quit\n')
call(["supervisorctl", "restart", "all"])
listener.ok(sys.stdout)
if __name__ == '__main__':
main()
しかし、それは物事を行う最善の方法ではありません。