This scripts displays the timer triggers for all the jobs in order to better arrange them.
import hudson.model.* import hudson.triggers.* for(item in Hudson.instance.items) { for(trigger in item.triggers.values()) { if(trigger instanceof TimerTrigger) { println("--- Timer trigger for " + item.name + " ---") println(trigger.spec + '\n') } } }
Sample ouput produced:
--- Timer trigger for LIC-01-BuildXnetWebApp --- # from Monday to Friday, at 6:00am 0 6 * * 1,2,3,4,5 --- Timer trigger for PTF-01-BuildXnetWebApp --- # from Monday to Friday, at 5:00am 0 5 * * 1,2,3,4,5 --- Timer trigger for WRH-01-BuildXnetWebApp --- # from Monday to Friday, at 7:00am 0 7 * * 1,2,3,4,5 --- Timer trigger for XNT-01-BuildCore --- # from Monday to Friday, at 5:00am 0 5 * * 1,2,3,4,5
3 Comments
Wolfgang Fahl
Thank you for the script. Please find below an extended version which sorts by hour and minute of the timer spec
Wolfgang Fahl
The following extended version shows the goals for maven jobs and the output is formatted a bit more
Example output
Flemming Steffensen
These are great... but do they actually work in a current Jenkins?
Testing with 2.91, it seems they don't.