Property Expressions Exercise 8
Exercise 8: Multiple Time Windows
Objective
To create a job that can run in multiple time windows with the use of an expression.
Summary
Utilize an expression and a Property called FAKETIME to prevent a job from running unless it is between 2 AM and 5 AM, 11 AM and 2 PM, or 5 PM and 8 PM.
Instructions
Create the Property
- Create a Global Property called
FAKETIMEwith a value of0.
Create the Schedule
- Create a Schedule named Multiple Time Windows.
Create the Jobs
- Create a NULL Job that is constrained by three Time windows.
- Use the
[[FAKETIME]]Global Property that will allow us to manually update the Time. - Between
2and5am - Between
11am and2pm - Between
5and8pm (ToInt([[FAKETIME]]) > 02 && ToInt([[FAKETIME]]) < 05) || (ToInt([[FAKETIME]]) > 11 && ToInt([[FAKETIME]]) < 14) || (ToInt([[FAKETIME]]) > 17 && ToInt([[FAKETIME]]) < 20)
Build the Schedule
- Build the Schedule.
- Verify that the Job did not run.
Manipulate the Property
- Update the Property to a value between
02and05 - Verify that the Job ran.
- Update the Property to a value between
05and11. - Restart the Job.
- Verify that the Job is waiting.
- Update the Property to a value between
11and14. - Verify that the Job ran again.
- Update the Property to a value between
14and17. - Restart the Job.
- Verify that the Job is waiting.
- Update the Property to a value between
17and20. - Verify that the Job ran again.
- Update the Property to a value between
20and24. - Restart the Job.
- Verify that the Job is waiting.
note
In the real world, a Latest Start Time would be used.