Get notification from “supervisord” when a job exits

Getting notification from “supervisord” there is a plugin called superlance.

You can install it with “pip install superlance” or download it from “http://pypi.python.org/pypi/superlance

After installing superlance then open “supervisord.conf” from “/etc/supervisor/” and add the following lines:

[eventlistener:crashmail]
command=/usr/local/bin/crashmail -a -m [email protected]
events=PROCESS_STATE

Then execute “supervisorctl update”. When a process “exits” you will now get a notification sent to [email protected].

If you only want to get notification for some selected apps then you can exchange the -a for a -p program1 or if it is a group group1:program2.

[eventlistener:crashmail]
command=/usr/local/bin/crashmail -p program1 -p group1:program2 -m [email protected]
events=PROCESS_STATE

You should make sure that autorestart is set to true (it is set to unexpected by default). This way the package will be restarted 3 times. If after that it still exits, it gives up, but you can change that with startretries.

[program:cat]
command=/bin/cat
autostart=true
autorestart=true
startretries=10