2
votes

I've read the help in Jenkins itself and also How to schedule jobs in Jenkins?.

In Jenkins you can build a job periodically by defining a cron like syntax with the addition of H(for "hash").

So defining

H H(0-7) * * *

means build once between 0:00 AM and 7:00 AM.

But how can I define 1 job between 20:00 PM and 7:00 AM of the next day?

Is there any way?

I tried doing

H H(20-23) * * *
H H(0-7) * * *

but ofcourse this will build two times.

Is there any possibility to make it only build once but within this time frame?

1
This has been answered in stackoverflow.com/questions/17195208/…Andi

1 Answers

1
votes

Not exactly an answer but a workarround:

A possible workaround could be to simply use a shifted timezone as e.g.

My Server has Timezone MEZ which equals GMT+1

so I could probably use something like

TZ=Etc/GMT+6
H H(13-23) * * *

this will run the build between 8:00 PM and 7:00 AM of the next day.