$schedule->command('...')->weekdays()->hourlyAt('55');
Which days and at what hours does this command work?
weekdays() means that it will be executed on every day except the weekend, so only on Monday, Tuesday, Wednesday, Thursday, and Friday.
hourlyAt('55') means that it will be executed every hour at 55 minutes. So 0:55, 1:55, 2:55, 3:55, ..., 22:55, and 23:55.
These two methods together mean that the given command will be executed every hour at minute 55 on Monday, Tuesday, Wednesday, Thursday, and Friday.
Here's a link to the documentation: Schedule Frequency Options
Related
I need to complete timesheet of work until midnight of every last day of month. Since it's easy to forget, I want to set reminder on say 1PM of the last day. What's the correct syntax to configure it?
All my attempts either don't work or are clumsy:
/remind me "Complete timesheet!!!" at 13:00 on the last day of every month - sets 1st instead and does not completely understand
/remind me "Complete timesheet!!!" at 13:00 on the 31st of every month - works for 31-day-long months, ignores for shorter months
/remind me "Complete timesheet!!!" at 13:00 on the 30st of every month - (I guess) works every month except February, for 30-day-long months one can manually snooze by day
/remind me "Complete timesheet!!!" at -11:00 on the 1st of every month - sets 1st instead and does not completely understand
/remind me "Complete timesheet!!!" 11 hours before 1st day of every month - sets 1st instead and does not completely understand
12x copy of /remind me "Complete timesheet!!!" at 13:00 every November 30th for literally mentioned last day of every month - works but too lengthy
I will also accept answer with link to any documentation with formalized syntax of /remind command (BNF, railroad diagram) from which the possibility of such command would be either provable or disprovable.
How can i set Scheduler of Ibm on the first Monday of the week? If i set DayOfMonth 1-7 and DayOfTheWeek 2 together receive an error. Is not good simbol as 2#1
The error is consistent with the documentation
https://www.ibm.com/docs/en/was-zos/8.5.5?topic=SS7K4U_8.5.5/com.ibm.websphere.javadoc.doc/web/apidocs/com/ibm/websphere/scheduler/UserCalendar.html
which states, "The day of week and day of month terms cannot be specified at the same time. One must be a '?' and the other a term."
Regarding your question, you asked about the "first Monday of the week". Did you mean first Monday of the month?
Here is an example of Monday of every week at 8am:
0 0 8 ? * MON
where the Scheduler cron terms are
second minute hourOfDay DayOfMonth Month DayOfWeek
If you want only the first Monday of the month, the Scheduler CRON doesn't have a way to do it.
An easy, but inefficient, solution would be to use the syntax for every Monday and have your task logic return immediately and skip itself if not a first Monday.
You also have the option of supplying your own UserCalendar implementation to implement customized scheduling:
https://www.ibm.com/docs/api/v1/content/SS7K4U_8.5.5/com.ibm.websphere.javadoc.doc/web/apidocs/com/ibm/websphere/scheduler/TaskInfo.html#setUserCalendar(java.lang.String,%20java.lang.String)
Is there a Slack reminder for last day of the month so that the reminder will occur on the 31st, 30th, or the 28th depending on the month?
Does something like /remind #channel to do X on the last day of the month work?
This syntax seems to work in setting a reminder for the last day of every month:
/remind #someone [What] on the 31st of every month
There is a way but i could not find the best one to do it:
/remind #someone [What] on the 28th of every month
This will remind you on the 28th day of every month. Unfortunately there is no way of working this around. You can set a reminder for every 1st day of the month too:
/remind #someone [What] every month
You can set a reminder for every month but its not that easy to manage:
/remind #someone [What] on the 31st of every January
and so on.
I've just created 12 reminders for myself for the next year
/remind #yourname to "Fill time-report" at 9:00 on Sep 30
/remind #yourname to "Fill time-report" at 9:00 on Oct 31 # Note that October has 31 days
...
This way you can adjust for last weekday of the month being a holiday in your country
Why does the number of the week of the year start with 1 in 2017 and 0 in 2018?
Date.strptime('2017-01-01', '%Y-%m-%d').strftime('%Y-%m-%d %U') #2017-01-01 01
Date.strptime('2018-01-01', '%Y-%m-%d').strftime('%Y-%m-%d %U') #2018-01-01 00
From the Ruby docs
Week number:
The week 1 of YYYY starts with a Sunday or Monday (according to %U
or %W). The days in the year before the first week are in week 0.
%U - Week number of the year. The week starts with Sunday. (00..53)
So it seems that Ruby identifies the "first week" (week 1) as starting with the first Sunday of the year. Anything that happens to come before that exists in week 0. 2017 happened to start on a Sunday, so the first day started the first week. However, 2018 started on a Monday, so week 1 of 2018 will start on January 7th, the first Sunday of the year.
To show week numbers according to ISO-8601, use %V:
# %V - Week number of the week-based year (01..53)
Date.strptime('2017-01-01', '%Y-%m-%d').strftime('%Y-%m-%d %V') #2017-01-01 52
Date.strptime('2018-01-01', '%Y-%m-%d').strftime('%Y-%m-%d %V') #2018-01-01 01
In general:
Week number according to the ISO-8601 standard, weeks starting on Monday. The first week of the year is the week that contains that year's first Thursday (='First 4-day week').
https://www.epochconverter.com/weeknumbers
I want to schedule to run a shell script on a Thursday which comes after the second Tuesday of every month. How to schedule this in crontab?
The second Tuesday of the month will occur between the 8th and the 14th inclusive, so set the day-of-week field to 4 (Thursday), and the day-of-month field to 10-16 (that is, a range adjusted to be two days after the range of the month's second Tuesday).