>
> Old post, I know, but I just came across this issue so thought I'd add my 
> findings.  https://issues.jenkins-ci.org/browse/JENKINS-14771 looks to be 
> the same issue, the reason for the NPE is that while you've added the 
> trigger to the job you haven't told the trigger about the job.  To work 
> around it I used this code:
>

def job = hudson.model.Hudson.instance.getJob("My Job");
def spec = "0 0 1 * *";
hudson.triggers.TimerTrigger newCron = new 
hudson.triggers.TimerTrigger(spec);
newCron.start(job, true);
job.addTrigger(newCron);
job.save(); 

It's the call to TimerTrigger.start that sorted it for me.


-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to