Reputation: 188
I want to know how I can get scheduled jobs for lets say 2 days from now on. From Jenkins API.
I have nearly hundred jobs scheduled, I am having hard time tracking them. I would love a easy check on which of them are going to run tomorrow.
Upvotes: 1
Views: 6017
Reputation: 176
You could also use this to print out scheduled jobs:
import hudson.model.*
import hudson.triggers.*
Jenkins.instance.getAllItems(Job.class).each { Job job ->
for(trigger in job.triggers.values()) {
if(trigger instanceof TimerTrigger) {
output = sprintf("%-30s %-30s", trigger.spec.trim().replace("\n", ", "), job.name.trim())
println(output)
}
}
}
Upvotes: 3
Reputation: 4767
This groovy script should help you : DisplayCronTiggersInViewDescription.
Look for TimerTrigger (or SCMTrigger)
Personally, I would just run as a standalone groovy script or from console and forget updating the view. You also may want to look for SCMTrigger (ie Poll SCM).
This script will let you manipulate them too.
There are similar answers within s/o if you look.
Upvotes: 3
Reputation: 719
If the goal is to track future jobs, give a try with Calendar View - allows you to have a month, week and day view of past jobs (and their results) as well for the future jobs.
Upvotes: 1