How to: Cron expression for multiple days on 2nd Week - cronexpression

I was wondering if it will be possible to build a cron expression for the following scenario:
Occurs every 2 week(s) on Monday and Tuesday. (I understand these options are not checked in the attached image)
This is the requirement
I checked http://www.cronmaker.com/ "weekly" tab option, but it is missing an entry box to enter values.
Can you please assist if this can be achieved?
Thanks,
Hemant.

Related

cronjob executed on wrong day

I want a script to be executed each first Saturday of a quarter.
Therefore I have set a crontab line up with the following
24 9 1-7 1,4,7,10 6 /absolute/path/to/script
This script was now executed yesterday, at 9:24 (ok),on Saturay (ok), but on October(ok) 16th(NOK).
Any hints what I missed or misunderstood?
Thanks a lot.
The script runs every day the first 7 days and every Saturday of the specified months.
The reason is well explained in this crontab guru page (and crontab(5)'s man page). The relevant piece is:
Note: The day of a command's execution can be specified in the following two fields --- 'day of month', and 'day of week'. If both fields are restricted (i.e., do not contain the "*" character), the command will be run when either field matches the current time. For example,
"30 4 1,15 * 5" would cause a command to be run at 4:30 am on the 1st and 15th of each month, plus every Friday.
You can check that this is indeed what happens by checking the description and when your script will be run next ("next at") here.
The way to achieve what you want, i.e., run the script on the first Saturday, is described in other questions/answers. See, for instance, Run a cron job on the first Monday of every month? or How to schedule to run first Sunday of every month. In short, replace 6 with * and combine your command with a call to date.

Power Automate: Send reminder out 3 months in advance

I have a Microsoft List that has a column called Expiration Date (text in format of MM/DD/YYYY) and Point of Contact (text in format of email#domain.com). How do I create a flow that sends an email out to the Point of Contact 3 months in advance?
My idea was to create a scheduled cloud flow that:
Repeats every day
Looks at every row in specific list
Compares if Expiration Date - 3 Months = Today
If True, send email to Point of Contact
I am currently stuck on step 3 to compare the date. I did Subtract from time to subtract 3 months from Expiration Date but now I do not know how to use this value to compare to today's date.
A better approach is to filter the list by using an OData filter. That will result in a list with all the elements you need.
For doing so, you need to specify the "Filter Query" field (in red):
First type
ExpirationDate eq ''
Then, between the quotes, add an expression, and select the functions addDays and utcNow in the following way:
addDays(utcNow(),92,'MM/dd/yyyy')
Please notice the following:
I'm adding 92 days to get the same day three months in advance for today (today is Oct 18th, so I'm looking for Jan 18th). Maybe adding just 90 days would work for you.
If you just want to add 3 to the month, you would need to get today's date to a variable with utcNow('MM') to get only the month, add 3 to it, and then create the expression accordingly.
I'm sorry the UI is in spanish. I'm from Mexico. But it's the same idea.
In the image, it reads "ExpirationDateText" because that's the way I named the field in my example. In your case, "ExpirationDate" should work.

How to create cron job to close period each month

I have a project where I have to update a field in my database every 1st day of each month and update it again every 10th after.
This cron allow me to open a session and to close it. I would like to know how can I set up the 10th of the month.
1st day of each month I have : 0 0 1 * *
10th after it : ??
Thanks :)
You can create a Cron expression that passes two dates in the day variable. Something like this would work:
0 0 0 1,10 * ? *
Expression description:
At 00:00:00am, on the 1st and 10th day, every month
You can use the comma in order to pass multiple variables in the day parameter in order to set multiple days to run.
A great resource for playing around with Cron statements is the Cron formatter website, which will let you enter statements, then give you the plain English logic that the statement will follow. It also shows which sections of the statement resolve to minutes, hours, days, ect.. It is really helpful for creating new statements in my opinion.

Working out number of days between 2 dates based on a specific premise

I'm wondering if anyone can help me. I have a spreadsheet which I use to populate scheduled meetings of various venues (at the moment these dates I enter in manually from a reference sheet as I don’t know how to do it with a formula).
Each week, when staff go to the venue for their meeting I then enter in (again manually) what date they actually went to the venue for the meeting.
What I then have to do, is work out if they went to the meeting within our agreed time-frame, and if not, how many days late were they. However, this calculation part will just take days to do by hand as there are so many meetings to analyse.
To work out if someone is within time frame or is late, it works on this premise:
If your meeting was scheduled to take place in say week 40, you have until the Friday of week 41 to go. Any working day after that is a day late (so if for example you ended up going to the meeting on the Tuesday in week 42 you would be 2 days late). Weekends and holidays should not be included in the calculation as staff don't work on bank holidays.
The link shows an example of how this looks - you can pretty much ignore the first tab as that's just me working out some example dates to put into the main tab and the last tab is the bank holidays for the remainder of this year and next.
https://docs.google.com/spreadsheets/d/1KaEAB59311W8_M1FdAL96753SirqY3dtl4eTzIruzK8/edit?usp=sharing
Thanks so much in advanced for reading this, and if anyone is able to help or has any ideas on how to even get started with this I’d really welcome your thoughts !
Okay, this was my best attempt at this for the time I've got now - This will work if the max amount of time that a scheduled meeting can take place is up to 2 weeks beyond the original limit - anything more than that and it will be off, but you could change that IF formula to account for that:
=IF(D2-(B2+13-WEEKDAY(B2))<0,0,IF(D2-(B2+13-WEEKDAY(B2))>7,D2-(B2+13-WEEKDAY(B2))-4,D2-(B2+13-WEEKDAY(B2))-2))
Screenshot from posted file:

cron expression for quartz to start on particular month and repeat every months onwards

I am working on Quartz Scheduler where need to trigger my job on basis of monthly where user can select desired month date from which he want to make it run for every month on that particular date. lets say- I want to schedule quartz job from August 20,2015 which should run every month on 20th, but it should not start by today,must be start on August 20,2015 onward. what would be the cron expression for this?
I have tried a lot to find out the matching thread but did not worked for me.
like if i have to make for every month which start on 20 May 2015 and repeat every 20th date of month the cron expression would be [0 0 12 20 1/1 ? *].for this requirement lot of things available around and works nicely. but how to schedule Quartz which must fire on particular date and repeat onward for every month on that particular date and time?
Please help me out.any link or any guideline would be appreciable.

Resources