Have Supervisord Periodically restart child processes

The superlance package offers a memmon plugin for supervisor. memmon monitors memory usage for programs under supervisor control.

You configure memmon as a supervisor eventlistener:

[eventlistener:memmon]
command=memmon -a 200MB
events=TICK_60

The above configuration sets memmon to restart any program under supervisor control if it exceeds 200MB memory usage. It checks every 60 seconds.

You can configure memmon to monitor specific programs or program groups, setting limits for each.


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]