Making an aciton relevant after a particular day of week

I’m trying to write a relevance to allow users an option to patch on a preferred day of the week.

My plan is to have a user select a ‘preferred day of the week’ which would be stored as a client property setting PatchDay.

I’m having trouble with the relevance/login part. Here is what I have right now:

if (exists action AND exists headers “action-issuer-name” of action) then ((now - (it as string as local time) of value of header “action-start-time” of action ) > 7*day) or ((if ( it = sunday ) then 0 else if ( it = monday ) then 1 else if ( it = tuesday ) then 2 else if ( it = wednesday ) then 3 else if ( it = thursday ) then 4 else if ( it = friday ) then 5 else if ( it = saturday ) then 6 else 7) of (current day_of_week) as integer > (if ( it = sunday ) then 0 else if ( it = monday ) then 1 else if ( it = tuesday ) then 2 else if ( it = wednesday ) then 3 else if ( it = thursday ) then 4 else if ( it = friday ) then 5 else if ( it = saturday ) then 6 else 7) of (value of setting “PatchDay” of client as day_of_week) as integer) else true

This will work up until the end of the week, then it breaks because we start a new week.

I want to run only one action rather than multiple action, but I’m stumped as to how I can get this working.

So, what you want is to deploy a patching Action (presumably a Baseline), such that the action only becomes Relevant on the appropriate Day of the Week based on the “PatchDay” Client setting, correct?

If so, you don’t need to worry about the “Exists Action” or “Exists Headers” stuff. You simply need to write Relevance to compare what today is with what the user has selected. Your “Exists action” relevance clauses will ALWAYS evaluate to true from the standpoint of the Action itself, so ignore it.

You want the Endpoint to evaluate the Action as being Relevant ONLY on the day the user selects.

The Relevance Object “Current day_of_week” will tell you what day of the week it is “right now” from the endpoint’s point of view.

The following Relevance will evaluate to “True” if the Current Day_of_week equals the value of the Client setting “PatchDay”. Include this Relevance in a Baseline to which you add the patches you want deployed to the target computers. You will then Target “All Computers” that you want patched. The Relevance will return a FALSE for any computer where PatchDay is not set or where it is not the day of the week with a leading capital letter.

If Exists Setting "PatchDay" whose (set of ("Sunday";"Monday";"Tuesday";"Wednesday";"Thursday";"Friday";"Saturday") contains Value of it) of client THEN (Value of Setting "PatchDay" of client = Current Day_of_Week as string) ELSE FALSE

It’s up to you when you want the action to expire. I would recommend at least a month. Once the Action has executed on a given endpoint, unless you select “Reapply this action” it will only execute ONE time. If a target endpoint is not powered up on the day it is supposed to be patched, it will wait until the next proper day of the week, or until the action expires.

Hope this helps.

BTW: This Relevance will not care what time of day it is. If a computer is left turned on all night, then at 12:01am (or there about), it’s going to start installing the patches.

The problem with that relevance, is that it will only patch on that day.

I should state that I want my action to remain applicable. I need my users to be able to defer an action as needed.

For example: Alice selects Wednesday to be her ‘patch day’. An action is sent on Tuesday. Alice does not get the message until Wednesday. Alice decides to defer the installation by one day. Alice then installs the patch on Thursday.

I’m trying to get this done without having to issue multiple actions… but I don’t think it’s possible in BigFix… at least at my still level.

OK. I misunderstood.

So I understand … you want the Baseline Action to become relevant once their selected Patch Day has passed and for it to remain relevant until the Action expires?

I think what you want IS possible.

  • (now - (it as string as local time) of value of header “action-start-time” of action ) . 7day / Is the Action over a week old?*/
  • Character 0 of (Elements whose (it as string contains (Current day_of_week) as string) of set of (“0Sunday”;“1Monday”;“2Tuesday”;“3Wednesday”;“4Thursday”;“5Friday”;“6Saturday”)) as Integer /* day of the week as an Integer 0-6 */

There has to be a way to do this. It feels like it should be something with Age of Action in Days vs the Start Day combined with their requested Patch day, but I can’t get a grip on it right now. It’s right there on the tip of my tongue!

Let me think about this some this afternoon and I’ll try to post a suggestion this evening.

As best I can tell, something along the following should work …

Definitions:

  • ActionAge = Number of days Since Action start.
  • Today = Numeric form of Day of Week from previous posting.
  • ActionStart = Day of week the Action was started.
  • MyPatchDay = Day of week user should be patched after.

In plain(?) English …
If (ActionAge < 7) THEN (((Today - ActionStart+7)mod 7) >= ((MyPatchDay - ActionStart+7)mod 7)) ELSE TRUE

In effect what the calculation above does is “roll” the “week” around so that the “ActionStart” day acts as the first day of the week.

Sunday = 0
Monday = 1
Tuesday = 2
Wednesday = 3
Thursday = 4
Friday = 5
Saturday = 6

Action Started on Wednesday (3)
My PatchDay is Monday (1)
Today is Thursday (4)

((Today-ActionStart+7)mod 7) >= ((MyPatchDay-ActionStart+7)mod 7)
Q: ((4-3+7)mod 7) >= ((1-3+7)mod 7)
A: False

Today is Monday (1)
Q: ((1-3+7)mod 7) >= ((1-3+7)mod 7)
A: True

You’ll need to replace the “English” “variables” with the appropriate Relevance. If you need help with the Relevance, let me know.

That’s exactly what my problem was, rolling to the next week. I’ll try this and return back the relevance I get.

Thank you!

How about something like…
if (not active of action) then true else if (now - parameter "action issue date" of action as time > 7 * day) then true else if not exists setting "PatchDay" whose (exists value of it as day_of_week) of client then true else ((item 1 of item 1 of (value of setting "PatchDay" of client,("Sunday",0;"Monday",1;"Tuesday",2;"Wednesday",3;"Thursday",4;"Friday",5;"Saturday",6)) whose (item 0 of it as string as lowercase = item 0 of item 1 of it as string as lowercase)) >= (item 1 of item 1 of ((day_of_week of date (local time zone) of now),("Sunday",0;"Monday",1;"Tuesday",2;"Wednesday",3;"Thursday",4;"Friday",5;"Saturday",6)) whose (item 0 of it as string as lowercase = item 0 of item 1 of it as string as lowercase)) )

I think you mostly had the logic you wanted, but I’m not sure “action-start-time” is the right property to check - I’m trying “action issue date of action” instead. You really shouldn’t be hitting a week rollover problem because you’re already trying to handle the 7*day case before it evaluates the day of the week. So I think you’re “action-start-time” logic is always evaluating false.