Display timer triggers

From Eclipsepedia

Jump to: navigation, search

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