So , please i use this cron expression in the orchestrator 0 0 0 ? * SAT,SUN 1/2 * * .
But this expression was rejected
@aya.lajili ,
Can you please elaborate clearly when you want to run the bot?
It should Work only in the weekend…Only that much?
Is there any time when the bot should run?
Hi @aya.lajili
Here is an example of a valid cron expression that runs a task every Saturday and Sunday at midnight:
0 0 0 ? * SAT,SUN
This expression has only five fields and specifies that the task should run at midnight (0 hours, 0 minutes) every Saturday and Sunday, regardless of the day of the month or month of the year.
okey , but i need a cron expression that run each two weeks on Sunday at 1p.m.
Hey @aya.lajili
I don’t think its possible with one cron expression.
How about this alternative using two crons like this:
Cron #1 - First Sunday of every month
0 0 13 ? * 1#1 *
Description: At 1pm, on the 1st Sunday of the month, every month
Cron #2 - Third Sunday of every month
0 0 13 ? * 1#3 *
Description: At 1pm, on the 3rd Sunday of the month, every month
Its not pefect as there as some months that have 5 weeks etc. Maybe this works for you.
Another option is to have it run every Sunday then setup a non working days calendar…
Hopefully this helps
Cheers
Steve
Hi @aya.lajili
After extensive research, I noticed that it’s not possible to trigger a process in a bi-week fashion. Although, I suggest you look at this workaround, which will trigger your process every 2 weeks once.
- Build a simple supporting process. Trigger the process on every Saturday using the following cron:
0 0 10 ? * SAT *
This will trigger the supporting process every Saturday at 10:00 AM.
- In the process, get the week’s number by using the following function:
System.Globalization.ISOWeek.GetWeekOfYear(Today)
For ex: Today is 5th of April, which means the week number is 14.
-
After getting the week number, you can check whether it’s an odd week or an even week. You can do this by dividing the week number%2.
-
If it’s an even week, finish the process without doing anything. If it’s an odd week, it will push a queue item to a specific queue created in the orchestrator. (The queue solely for this process sake)
-
For the main process, you can configure a queue-based trigger with the above-specified queue as an anchor.
By this way, the supporting process runs every week but created a queue item every 2 week, and the main process runs every 2 weeks based on the incoming queue item.
You can apply the same logic for Sunday triggering process as well.
Hope this helps. If you face any difficulty building this process, do let me know by dropping an email: alternatearjun@gmail.com
Best Regards.