How to stop supervisord when a specific program stopped normally

杀马特。学长 韩版系。学妹 提交于 2019-12-24 11:21:36

问题


I am using supervisord inside docker to run two processes:

  1. the main process and
  2. an ssh tunnel needed by the main process

When the main process stops normally, the ssh tunnel process stays alive forever, preventing the docker from stopping. This is problematic as the container runs as a Kubernetes job, that needs to terminate when the main process finished.

The question is, is it possible to kill the ssh tunnel when the main process stops or even better: stopping supervisord when the main process stopped?


回答1:


use event listner:

[eventlistener:MyMainProcessName]
command=kill -3 $(cat "/var/run/supervisord.pid")
process_name=MyMainProcessName
events=PROCESS_STATE_STOPPED, PROCESS_STATE_EXITED, PROCESS_STATE_FATAL

that will send SIGQUIT to Supervisor if that process stopped



来源:https://stackoverflow.com/questions/58131968/how-to-stop-supervisord-when-a-specific-program-stopped-normally

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!