BatchPatch Job Queue Branching Based on DateTime or Number of Iterations

In the most recent release of BatchPatch (August 2021), we added some new special items to the Job Queue that will give you more flexibility in your queues.

  • If this step is executed X time(s), terminate queue
  • If this step is executed X time(s), goto label:Y
  • If this step is executed between DateTimeBEGIN and DateTimeEND, terminate queue
  • If this step is executed between DateTimeBEGIN and DateTimeEND, goto label:X
  • If this step is executed between DayOfWeekBEGIN and DayOfWeekEND, terminate queue
  • If this step is executed between DayOfWeekBEGIN and DayOfWeekEND, goto label:X
  • If this step is executed between TimeOfDayBEGIN and TimeOfDayEND, terminate queue
  • If this step is executed between TimeOfDayBEGIN and TimeOfDayEND, goto label:X

One of the ways that we anticipate these options will be used is with recurring tasks that have to be executed multiple times throughout the day on a given day. For example, let’s say that you want or need to execute a script or command or actions of some kind on target computers every 15 minutes throughout the day, every day. However, you only want the command to be executed between the hours of 9AM and 5PM. You can do something like what I’ve done here, where I’ve setup my BatchPatch job queue to run on a 9AM daily recurring scheduled task. The queue itself is a loop that runs every 15 minutes to execute my custom remote command, but in each iteration of the loop, there’s a check to see what time it is. If the loop executes any time after 5PM (17:00) and before 9AM (09:00), the queue is terminated. This has the effect of running the queue loop every 15 minutes throughout each day but only during the 9AM to 5PM window. Outside of those hours, the queue is terminated until the next day when the scheduled task kicks off anew at 9AM. With all of the new special queue items shown above, you can see there’s now quite a bit of flexibility that wasn’t previously available. While we know that not everyone will need or care about these options, we expect there will be a good number of people who make great use of them.

This entry was posted in Blog, General, Tutorials and tagged , . Bookmark the permalink. Both comments and trackbacks are currently closed.