Defining node jobs for these use cases

Hi, I am using the node program to define a job in my application ( https://github.com/rschmukler/agenda ). I have two use cases that I don’t know how to cover

1) I want the task to run every Tuesday or every Wednesday, for example

2) I want the task to be performed every 5 or 10 of the month.

I know the node span uses the human spacing ( https://github.com/rschmukler/human-interval ) to interpret how often they want to run tasks, but I see that it can only interpret units such as days, weeks, months, etc. Any idea on how I could cover the two use cases that I mentioned above?

In case of using 1, I found that I can do something like this (from the documentation on the agenda):

var weeklyReport = agenda.schedule('Saturday at noon', 'send email report', {to: ' another-guy@example.com '}); weeklyReport.repeatEvery('1 week').save(); agenda.start(); 
+6
source share
1 answer

You can use cron format:

1) weeklyReport.repeatEvery( "0 0 * * 1,4")

Where 1 is Monday and 4 is Thursday.

2) weeklyReport.repeatEvery("0 0 1,15 * *")

This will work on the 1st and 15th of the month

+4
source

Source: https://habr.com/ru/post/989584/


All Articles