Reputation: 665
I know this might sound a bit dumb, but can I use node-cron to create two crone-jobs to run on two days of the week which are non-consecutives? Do I need to call two CronJob functions, or is there a way to use only one?
Upvotes: 5
Views: 2595
Reputation: 1916
Node-cron uses the same rules as crontab, so you can set a rule like this:
cron.schedule('30 3 * * sun,tue', function(){
console.log('running a task at 3:30 on Sunday and Tuesday');
});
Note that this is only if you want to run the same job on both days. If you wan to run different jobs you have to create different tasks.
Upvotes: 7