how does one add a stanza to be executed on job failure, or does one need a separate job for this situation?

Asked by Whit Armstrong

how does one add a stanza to be executed on job failure?

We currently run jobs via cron, so we just set

Question information

Language:
English Edit question
Status:
Answered
For:
upstart Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Whit Armstrong (armstrong-whit) said :
#1

(sorry, premature click on the first post)

We currently run jobs via cron, so we just set MAILTO in the cronjob and we see all the logs successful or not.

With upstart, it seems like we can either set up a section of code to be executed on job failture, or we can emit a job failed event and set up another job which listens for that event, and notifies the appropriate people.

Have I missed the documentation for this topic? If so, I apologize.

-Whit

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) said :
#2

Currently you'd need to create a separate job that reacted to the failure, for example:

   start on stopped foo failed

(the "failed" argument to the stopped event already exists)

It's planned that you'd be able to have the failure information delivered to you by e-mail as cron already does (as part of the goal to replace cron), also you'd be able to include the "failure handler" inside the same job definition

Can you help with this problem?

Provide an answer of your own, or ask Whit Armstrong for more information if necessary.

To post a message you must log in.