Reputation: 9522
Is it possible to send an email notification in case of upstart reaching the respawn limit?
respawn
respawn limit 5 60
Upvotes: 3
Views: 859
Reputation: 616
Yes.
When the respawn limit is reached, Upstart emits the stopped event with a twist: the PROCESS env var is set to "respawn".
The following job utilizes this event to send a notification:
start on stopped JOB=job-de-manuel RESULT=failed PROCESS=respawn
task
exec sendmail # yada yada yada
If you are unsure on how to fill in the sendmail arguments, just read the manpage.
Also, you may wish to receive an email if the job was not configured to respawn. If so, just remove the PROCESS=respawn bit and keep the RESULT=failed bit (as well as the JOB= variable).
Upvotes: 5