Once the trigger's job runs the trigger will reflect the state of the it's job. The trigger will continue to reflect it's job's state until it is reset.
Subsequent state changes in the triggering job are ignored until the trigger is reset and re-run.
If the triggering job is destroyed, because it is deleted or on a remote server the trigger will enter an exception state.
cancelWhen | A state condition that will cause the trigger to cancel. |
job | The job to run when the trigger fires. |
name | A name, can be any text. |
newOnly | Fire trigger on new events only. |
on | The job the trigger will trigger on. |
state | The state condition which will cause the trigger to fire. |
Example 1 | A simple trigger. |
Example 2 | A trigger that runs once two other jobs have completed. |
Example 3 | Cancelling a trigger. |
Example 4 | Examples Elsewhere. |
Configured By | ATTRIBUTE |
Access | READ_WRITE |
Required | No, defaults to not cancelling. |
A state condition that will cause the trigger to cancel.
Configured By | ELEMENT |
Access | WRITE_ONLY |
Required | Yes. |
The job to run when the trigger fires.
Configured By | ATTRIBUTE |
Access | READ_WRITE |
Required | No. |
A name, can be any text.
Configured By | ATTRIBUTE |
Access | READ_WRITE |
Required | No, defaults to false. |
Fire trigger on new events only. If set the time on the event will be compared with the last that this trigger received and only a new event will cause the trigger to fire.
Configured By | ATTRIBUTE |
Access | READ_WRITE |
Required | Yes. |
The job the trigger will trigger on.
Configured By | ATTRIBUTE |
Access | READ_WRITE |
Required | No, defaults to COMPLETE. |
The state condition which will cause the trigger to fire. See the Oddjob User guide for a full list of state conditions.
A simple trigger.
<oddjob id="this"> <job> <sequential name="Trigger Example"> <jobs> <scheduling:trigger name="Alert Trigger" on="${important}" xmlns:scheduling="http://rgordon.co.uk/oddjob/scheduling"> <job> <echo name="Alert">Important job has completed!</echo> </job> </scheduling:trigger> <folder name="A Folder of Jobs"> <jobs> <echo id="important" name="Run Me">I'm important</echo> </jobs> </folder> </jobs> </sequential> </job> </oddjob>
A trigger that runs once two other jobs have completed.
<oddjob xmlns:scheduling="http://rgordon.co.uk/oddjob/scheduling" xmlns:state="http://rgordon.co.uk/oddjob/state"> <job> <sequential name="Trigger on Two Things"> <jobs> <scheduling:trigger id="trigger" on="${watch-both}"> <job> <echo id="notify" name="Triggered Job">You ran two things!</echo> </job> </scheduling:trigger> <state:and id="watch-both" name="Watch Two Jobs"> <jobs> <state:mirror job="${thing1}" name="Mirror Job 1"/> <state:mirror job="${thing2}" name="Mirror Job 2"/> </jobs> </state:and> <folder name="A Folder of Jobs"> <jobs> <echo id="thing1" name="Run me!">Thank you</echo> <echo id="thing2" name="Run me!">Thank you</echo> </jobs> </folder> </jobs> </sequential> </job> </oddjob>
Cancelling a trigger.
<oddjob id="this" xmlns:scheduling="http://rgordon.co.uk/oddjob/scheduling"> <job> <sequential name="Trigger Example"> <jobs> <scheduling:trigger id="trigger" name="Alert Trigger" on="${our-job}" state="FAILURE" cancelWhen="FINISHED"> <job> <echo name="Alert" id="triggered-job">That job shouldn't fail!</echo> </job> </scheduling:trigger> <folder name="A Folder of Jobs"> <jobs> <echo id="our-job" name="Run Me">I won't fail</echo> </jobs> </folder> </jobs> </sequential> </job> </oddjob>
Examples Elsewhere.
examples/scheduling/dailyftp.xml
)
uses a trigger to send an email if one of the FTP transfers fails.