# Build periodically after schedule (disble running on system startup)

**URL:** https://community.jenkins.io/t/build-periodically-after-schedule-disble-running-on-system-startup/13266
**Category:** Ask a question
**Created:** [March 12, 2024, 5:22pm UTC](https://community.jenkins.io/t/build-periodically-after-schedule-disble-running-on-system-startup/13266 "2024-03-12T17:22:22Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Nux](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/nux/32/5165_2.png) [@Nux](https://community.jenkins.io/u/Nux)
#### Post date: [March 12, 2024, 5:22pm UTC](https://community.jenkins.io/t/build-periodically-after-schedule-disble-running-on-system-startup/13266/1 "2024-03-12T17:22:22Z")

</div>

Hi. How do I disable delaying schedules? When a computer is turned on after hibernation, it becomes very sluggish. It seems all scheduled tasks that were missed are getting executed.

My setup for a `projects-up` job: Build periodically: H H(11-12) \* \* 1-5.

When I turn the computer on at say… 16:00, I do _not_ want the task to be executed. So basically, I want it to run as classic cron, not as anacron.

---

<div class="post-metadata">

### Author: ![Nux](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/nux/32/5165_2.png) [@Nux](https://community.jenkins.io/u/Nux)
#### Post date: [March 20, 2024, 9:28am UTC](https://community.jenkins.io/t/build-periodically-after-schedule-disble-running-on-system-startup/13266/2 "2024-03-20T09:28:12Z")

</div>

I’ve solved it using System Groovy Step:

```auto
import hudson.model.Cause
import hudson.model.AbstractBuild

def cause = build.getCause(Cause.UserIdCause.class)
if (cause != null) {
	println("Skipping hour check. This build was started by user: " + cause.getUserName())
} else {
	// Get the current hour
	def hour = new Date().format('H', TimeZone.getDefault())
	int hourInt = Integer.parseInt(hour)

	// Check if time is outside of designed hours
	if (hourInt < 14 || hourInt > 15) {
		println "Current hour is $hourInt. It is outside the scheduled time window. Exiting job."
		throw new InterruptedException();
	}
}

```
