Launchd schedule for last day of month - launchd

I'm trying to schedule a job for the last day of every month using Launchd but I'm not quite sure how to do it. It seems the only options I get are numerals for selecting the day of the month so, for example, I can select to run on day 31, but what happens in February and September? If the value is 31, does Launchd just run it on the highest number day for each month?
Thanks for any help!
-Dan

AFAIK there isn't a "nice" way of expressing the last day of each month. If you do "31" it simply won't run in February or months ending in 30.
Can you work around that requirement, and simply use midnight of the first day of each month?
You could be verbose and do the following in the plist, and define the last day of each month. It will break in a leap year when February has 29 days.
<key>StartCalendarInterval</key>
<array>
<dict>
<key>Day</key>
<integer>31</integer>
<key>Month</key>
<integer>1</integer>
</dict>
<dict>
<key>Day</key>
<integer>28</integer>
<key>Month</key>
<integer>2</integer>
</dict>
<dict>
<key>Day</key>
<integer>31</integer>
<key>Month</key>
<integer>3</integer>
</dict>
</array>

Related

How to set a biweekly Cron job in App Engine

I'm trying to set a biweekly Cron job for a small Slack bot that I run at work off of App Engine. I previously had set it up in App Engine using the custom interval from the documentation to run every other week:
schedule: 1st,third Wednesday 10:00
I was waiting for the Slack bot to message today and it never came. Now the obvious solution is that I missed the 5th Wednesday of the month in my original scheduling statement. The problem here is that next week we will also get a message because it will again be the 1st Wednesday of the month. Is there a way to get the job to run as
schedule: every two Wednesday 10:00
or similar so that the job will run every two weeks?
In the documentation about formatting the schedule you can see under the "Custom Interval" tab what syntax options you have.
Given that you can specify days up to the 31st, I believe adding 5th to the expression you are using would fix the issue with "fifth" Wednesday:
schedule: 1st, 3rd, 5th Wednesday of month 10:00
If you don't mind the week day that you receive the update, you can also just set it to run every 14 days for simplicity:
schedule: 1, 14, 28 of month 10:00

Extended calendar which runs on 1st business day of 3rd of every month in autosys

I need to create extended calendar which will run on 1st business day of 3rd week of every month.
Mon to Fri are considered as working day and no holiday calendar included.
Sample dates for year 2018 :
16th Jan, 13th Feb, 13th Mar, 17th Apr, 15th May, 12th Jun, 17th Jul, 14th Aug, 11th Sep, 16th Oct, 13th Nov, 11th Dec
Currently I am using standard calendar for this but wants to change it to extended calendar to avoid manual inserts for every year.
#Manvi
not very confident of the exact condition and this would be a partial answer.
as for now i can think of
WEEK#03|WEEK#07|WEEK#11|WEEK#15|WEEK#20|WEEK#24|WEEK#28|WEEK#33|WEEK#37|WEEK#42|WEEK#46|WEEK#50
This would give you all the 3rd week of the the months and then hereon need to exclude the rest of the days.
You can refer this link for condition keywords.
Also, you can use below to include multiple keywords for desired output.
OR condition as "|"
NOT as "NOT"
Hope this helps. Good luck.
Will update incase i do find the solution.
Edits:
The first working day would definitely be a Monday and the previous day has to be 2nd Sunday.
Consider a calender as below
extended_calendar: Cal_name
description: 1st day of the 3rd week
workday: mo,tu,we,th,fr
non_workday:
holiday:
holcal:
cyccal:
adjust: +1
condition: sun#2
Sun#2 would consider the 2nd sunday of all months and the next day would mark the start of the 3rd week.
To consider the next day of the 2nd sunday adjust: +1 defined.
If you are looking for the 2nd day of the 3rd week. Defined adjust to +2.

QML Calendar: change first day of week

Is there any way to change the first day of the week on QML Calendar?
Not only Monday/Sunday, but also for any day of the week.
I found a workaround for Monday/Sunday; force Qt.locale() for a country which has Monday or Sunday specified as first day of the week, but it is not extended to the rest of the days. Thanks in advance!

gae cron job for last day of every month

I want the schedule of a cron job to be the las day of every month. I've used this:
<schedule>last day of month 23:59</schedule>
Is it correct?
The easiest way to launch the job at first of month 00:00. You may tweak it to run few hours before setting the <timezone> to the timezone with more positive value than the desired one. If desired timezone is GMT than you may set the timezone of the cron job to Europe/Berlin and the job will be executed last day of the month at 23:00 GMT.
As per the documentation, the format for the Cron Expression for the kind that you are trying to create is:
("every"|ordinal) (days) ["of" (monthspec)] (time)
Where:
ordinal specifies a comma separated list of "1st", "first" and so forth (both forms are ok)
days specifies a comma separated list of days of the week (for example, "mon", "tuesday", with both short and long forms being accepted); "every day" is equivalent to "every mon,tue,wed,thu,fri,sat,sun"
monthspec specifies a comma separated list of month names (for example, "jan", "march", "sep"). If omitted, implies every month. You can also say "month" to mean every month, as in "1,8,15,22 of month 09:00".
time specifies the time of day, as HH:MM in 24 hour time.
I don't think there is a direct expression for what you are trying to do.
You might need to create multiple cron expressions. For e.g. 31 of month 09:00 would address 31st day of all months at 9:00 AM and it should address all months that have 31 days and so on.

How to get first day of week in c

I am coding little calendar program in c.
I have issue to get first day of week in current locale, i need it to format calendar. For example Sunday - is first day of week in US, but in Europe first day of week is Monday. How can i get this information for current locale? Thank you.
You can create a config file containing a map of locale and first day of the week. Read this config file and create a look up table at the beginning of the program. Refer to this table everytime you are trying to get the first day of the week for a particular locale.

Resources