Run job once at 8 PM and stop at 6 AM in Quartz.net - quartz.net

How can i schedule job to run once at 8:00 PM Every Day and force it to stop at 6:00 AM in next day?

Setup trigger to run job every day at 8PM. If you prefer cron expressions, you can use cronmaker UI for expression generation.
As #derloopkat mentioned, Configuring Quartz.Net to stop a job from executing, if it is taking longer than specified time span shows approach how to stop job using IInterruptableJob interface. Moreover, cause you know exact time, when job should be stoped (6AM), you may not to use separate thread for Interrupt() method, but create another simple job that do interruption at 6AM by trigger.

Related

How to trigger a Jenkins Job and make the build to stay in queue for dynamic period of time

My scenario is to execute a Job_1 and trigger Job_2 with the information from the Job_1. But Job_2 should wait for specific period of time in the build queue. Delay hours is received from Job_1. So it would be dynamic. Job_2 should always run only after lapse of Delay hours.
Quiet Period will not help me in this case as it has static value to be configured.
Is there any way to achieve this?

Schedule job at specific dates

How to :
Schedule job at specific dates across several months ?
it will be ~10 dates.
Second is there a tool that simulate cron, such that u can pass date/time and the tool tell you did cron triggers or not
cron does not schedule events in that manner. Jenkins scheduler is cron-based.
This answer provides several options.
Apparently there is now a released plugin - Schedule Build which appears to support calling the scheduleBuild action referenced in my groovy based answer.
See constraint (you can only schedule one build at a time) unless parameterized.

Jenkins: Running/queuing a concurrent job with interval

I have a job and it can run concurrently. The trick part here is that this job needs to have an interval to one another, at least for 30 seconds. So when Build1 runs, Build2 should wait for 30 seconds to start.
I already tried using the quiet period but it does not fit my needs (it only works when a job is not triggered by Build Now or Build With Parameters)
Is there a way for me to be able to do this kind of condition?
You can try enumerating other builds of this job and sleeping until all the other builds have been running above 30 seconds. See example code in this answer.

Trigger dependent Jenkins job at specific time

I have 2 jobs called job A and job B.
If Job A is built successfully I want to trigger job B next day at 8 am.
How can I put condition to build trigger ?
I have done this by querying the upstream job with an intermediate job. The intermediate job is scheduled at 8am and queries job A using the Jenkins API to find out when it last run and triggers B if it has run in the last 24 hours.
We have parent job that triggers the child job only on success, after one hour of the completion of the parent job. In order to postpone the execution of the child job, we have specified a quiet time in the child job - this is a time measured in seconds that the job waits to be executed.
For more details about the setup in Jenkins, you could see this 1-minute youtube video.

How may I configure a Jenkins job to run at a specific time if an upstream job succeeds?

My use case:
Job A is set to run Monday through Friday at 18:00.
Job B is dependent upon Job A succeeding but should only run Monday through Friday at 06:00. (Monday morning's run would depend upon Friday evening's run). I prefer set times rather than delays between jobs.
On any given morning, if I see that Job A failed (thus Job B never ran), I would like to be able to run (fix) Job A then immediately trigger Job B.
What I have found so far only offers part of this use case. I have tinkered with Pipeline and recently upgraded my Jenkins instance to 2.89.3, so I have access to the most recent features and plugins. Filesystem triggering seems doable.
Any suggestions are appreciated.
You can use the options available in "Build Triggers".
Ex:
Build Trigger
Hope this work for you!
This is a tricky Use Case as generally you want a job to immediately follow on from another one rather than waiting for potentially three days.
Further complicated by wanting it to run straight away when you want it to.
I do not believe there is a "I have finished so kick this job at this time" downstream trigger So for the first part the only things I can think of are:
Job A kicks Job B as soon as it is finished and job B sits there with a time checker in it and starts its task when the time matches.
or Job A artefacts a file with its exit status and job B has a cron trigger for 6am mon-fri and picks up this artefact and then runs or doesn't dependent on the file contents
For the second part you could get the build Cause (see how to get $CAUSE in workflow for pipeline implementation and vote on https://issues.jenkins-ci.org/browse/JENKINS-41272 to get the feature when using sandbox).
And then get your pipeline to behave differently depending on trigger
i.e. if you went for the second option above then In job B you could do if triggered by Cron then read the artefact and do as needed. If triggered by Upstream then just run regardless.

Resources