This is just a nice addition to the fully automated setup of Jenkins described in One-Click Jenkins Setup.
Let's add a nightly build trigger via the (Groovy) Script Console.
The console is accessible through Jenkins -> Manage Jenkins -> Script Console
.
def job = Jenkins.instance.getItemByFullName("planets-homepage")
// add nightly trigger
job.addTrigger(new hudson.triggers.TimerTrigger("@midnight"))
That's it. Our job now has a nightly build trigger...nice.
If you got so far you might also like our other Jenkins related posts:
▷ Programmatically add Environment Variables to a Jenkins Instance
▷ How to Checkout a Gerrit Change in a Jenkins Sandbox Pipeline