1

I am trying to write cron job for every 5 minutes, starting from 4th minute, 9th, 14th, and so on...

const cron = require("node-cron"); 
cron.schedule(`4,9,14,19,24,29,34,39,44,49,54,59 * * * *`, async function() { 
    console.log('scheduleCron ',new Date());
    // my function call
}) 

It is executing perfectly, but I want to know is this the only method to do like this or any other method?

Thanks in advance :)

  • Why the `javascript` tag? – Andreas Apr 03 '21 at 13:48
  • Possible duplicate: [Run Cron job every N minutes plus offset](https://stackoverflow.com/questions/12786410/run-cron-job-every-n-minutes-plus-offset) – Andreas Apr 03 '21 at 13:49
  • Does this answer your question? [Run Cron job every N minutes plus offset](https://stackoverflow.com/questions/12786410/run-cron-job-every-n-minutes-plus-offset) – sideshowbarker Apr 03 '21 at 23:08

1 Answers1

1

“At every 5th minute from 4 through 59.”

4/5 * * * *

Crontab guru

Warning: Non standard! May not work with every cron.

0stone0
  • 34,288
  • 4
  • 39
  • 64