How do I perform an action if the upstart respawn limit is hit?

Posted by Daniel Huckstep on Server Fault See other posts from Server Fault or by Daniel Huckstep
Published on 2011-11-29T17:07:04Z Indexed on 2011/11/29 17:53 UTC
Read the original article Hit count: 306

Filed under:
|

I have an upstart job:

description "foreman"

start on runlevel [2345]
stop on runlevel [06]

respawn
respawn limit 3 60

chdir /home/deploy/app/current

env RAILS_ENV=production

exec sudo -u deploy bundle exec foreman start

We ran into a case where a rogue character in an app file caused one of the background workers to fail but the app ran normally (weird). The app worked fine, but the workers were never working.

I'd like upstart to do something (send an email) if it can't start this job, since it's not entirely obvious if everything went alright. Is there something built into upstart to handle this, or do I have to get creative?

© Server Fault or respective owner

Related posts about ubuntu

Related posts about upstart