Below cron job runs every Sunday 14:35:00, but I want to run the run job every 2 Sunday 14:35:00.
Is it possible to do that?
var CronJob = require('cron').CronJob;
new CronJob('0 35 14 * * 0', async function () {
}, null, true, 'America/Los_Angeles');
I didn't see any pattern for your requirement, but you can this
var CronJob = require('cron').CronJob;
var x = 1;
new CronJob('0 35 14 * * 0', async function () {
if (x / 2 != 1) {
x++;
//do somthing
} else {
x = 1;
}
}, null, true, 'America/Los_Angeles');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With