crashmail
is a supervisor "event listener", intended to be subscribed to PROCESS_STATE_EXITED
events. When crashmail
receives that event, and the transition is "unexpected", crashmail
sends an email notification to a configured address.
crashmail
is incapable of monitoring the process status of processes which are not supervisord
child processes.
crashmail
is a "console script" installed when you install superlance
. Although crashmail
is an executable program, it isn't useful as a general-purpose script: it must be run as a supervisor
event listener to do anything useful.
$ crashmail [-p processname] [-a] [-o string] [-m mail_address] \
[-s sendmail]
crashmail
-p <process_name>, --program=<process_name>
Send mail when the specified supervisord
child process transitions unexpectedly to the EXITED
state.
This option can be provided more than once to have crashmail
monitor more than one program.
To monitor a process which is part of a supervisord
group, specify its name as group_name:process_name
.
-a, --any
Send mail when any supervisord
child process transitions unexpectedly to the EXITED
state.
Overrides any -p
parameters passed in the same crashmail
process invocation.
-o <prefix>, --optionalheader=<prefix>
Specify a parameter used as a prefix in the mail Subject
header.
-s <sendmail_command>, --sendmail_program=<sendmail_command>
Specify the sendmail command to use to send email.
Must be a command which accepts header and message data on stdin and sends mail. Default is /usr/sbin/sendmail -t -i
.
-m <email_address>, --email=<email_address>
Specify an email address to which crash notification messages are sent. If no email address is specified, email will not be sent.
An [eventlistener:x]
section must be placed in supervisord.conf
in order for crashmail
to do its work. See the "Events" chapter in the Supervisor manual for more information about event listeners.
The following example assumes that crashmail
is on your system PATH
.
[eventlistener:crashmail]
command=crashmail -p program1 -p group1:program2 -m dev@example.com
events=PROCESS_STATE_EXITED