How do I send an email notification of an upstart reaching the respawn limit?

Can I send an email notification when an upstart reaches the respawn limit?

respawn
respawn limit 5 60

      

+3


source to share


1 answer


Yes.

When the respawn limit is reached, Upstart emits a stopped event with a twist: PROCESS env var is set to "respawn".

The following job uses 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 how to fill in the sendmail arguments, just read the man page.

Alternatively, you may receive an email if the quest has not been configured to respawn. If so, just remove the PROCESS = respawn bit and keep the RESULT = failed bit (as well as the JOB = variable).

+5


source







All Articles