Python – Have Supervisord Periodically restart child processes

gearmanPHPpythonsupervisord

I am using Supervisor (3.0a12) on ubuntu 12.04 to manage php gearman workers. Sometimes the workers get caught in a weird state where they use tons of cpu and ram. While I am figuring this issue out I thought it would be nice to have Supervisor automatically kill and refresh workers occasionally. I looked at http://supervisord.org/configuration.html the configuration documentation and didn't seem to see any options that would allow for this.

Does anyone know if it is possible to have supervisord periodically restart all processes it governs??

Best Answer

You could use crontab to pass commands directly to supervisorctl. For example, the following will restart a process every 20 minutes.

0,20,40 * * * * /path/to/supervisorctl restart [supervisor_process]
Related Topic