Creating a maintenace window for the last 'day' of the month

written by SyedIslam)

Hi

I’m currently deploying IEM v9 for out patching regime. Unfortunately some of our servers have a maintenance window for the last ‘day’ of the month. All I have found when creating the windows is ‘day’ of first week, second week, third week and fourth week.

Am I miising something or is it more complex?

Thanks.

written by jgstew

There does not appear to be a built in relevance check for last day of the month. Here is something that is incomplete:

if(current day_of_month as integer < 28) then false else if(current month as integer = 2) then /* check leap year and day / else if(current day_of_month as integer < 30) then false else / check months and ending days */

written by SyedIslam

Was really after a last day of month in terms of; last Sunday of Month or last Thursday of Month etc?

Any ideas?

Thanks.

(imported comment written by jgstew)

So you are not looking for the absolute last day, but the last occurrence of a particular day of the week?

written by SyedIslam

The last occurrence of a particular day of the month (rather than week).

written by jgstew

This is what I came up with, which I think will work:
http://bigfix.me/relevance/details/2998771

I am checking if 1 week in the future is the first day_of_week of the next month. If so, then the current date is the last day_of_week of the current month. The example uses “friday” but you can exchange “friday” for any day of the week you desire.

1 Like

written by jgstew

Did this work for you?

@jgstew

It worked for me!

Thanks

Bob_K