Need relevance to pause action during maint. window

(imported topic written by Mark_in_NM)

Hello, long time viewer, first time posting… All help is appreciated!

I have a custom task that installs an encryption client. This task is part of a larger baseline which performs multiple actions on the endpoints prior to encryption client install. Because of a required reboot prior to client install, I created multiple tasks, and linked them together in a baseline. Users will be given the option of taking action when their scheduling permits, with a 7 day deadline.

I have everything working, but have one issue. The encryption DB goes down every night at 9:30 PM, till 1:30 AM central time. We can perform other task in the baseline, but can not perform the actual client install while the DB is down. Given the unpredictability of user action plus the unpredictability of how long it takes to get through the actions in the baseline, I need to be sure the client install does not happen during the maint. window.

I’m thinking a “pause while” statement in the action script just before the client install would work, I just need help with the relevance to check the time. Something like this:

pause while { relevance to return true if between 9:30 PM and 1:30 AM central time}

Thanks again for any help with the relevance. Or any other suggestions or ideas.

(imported comment written by liuhoting)

You could do something like this… first get time:

Q: time (local time zone) of now

A: 02:37:21 -0700

Then get hour of time:

Q: two digit hour of time (local time zone) of now

A: 02

Then see if that’s between “21” and “24” or between “00” and “01” (I’m just checking the hours here but you could do a similar thing for minutes. The inspector is “two digit minute” of time.

(imported comment written by Mark_in_NM)

Thx! I believe I can use your sugestion, along with “local time zone” to get the time zone info, since the maint window will be different for each time zone.

(imported comment written by Mark_in_NM)

Here is what I came up with:

pause while {((local time zone as string = “-0400”) and (set of (22;23;0;1;2) contains (two digit hour of time (local time zone) of now as integer))) or ((local time zone as string = “-0500”) and (set of (21;22;23;0;1) contains (two digit hour of time (local time zone) of now as integer))) or ((local time zone as string = “-0600”) and (set of (20;21;22;23;0) contains (two digit hour of time (local time zone) of now as integer))) or ((local time zone as string = “-0700”) and (set of (19;20;21;22;23) contains (two digit hour of time (local time zone) of now as integer))) or ((local time zone as string = “-0800”) and (set of (18;19;20;21;22) contains (two digit hour of time (local time zone) of now as integer))) or ((local time zone as string = “-1000”) and (set of (16;17;18;19;20) contains (two digit hour of time (local time zone) of now as integer)))}

I need to double check the Hawaii time zone off set, make sure that is how it gets displayed. We will have to tweak the code with the time change in the fall. But for the most part this gets the job done. I decided to add a half hour cushion on each side of the maint window, plus it makes the code easier : )

Thanks again liuhoting.

On a side note, I wonder how often the “pause while” checks the relevance?