How do I perform an action if the upstart respawn limit is hit?
- by Daniel Huckstep
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?