Issue
I'm using node-cron to use cron.
Here is what I have done so far -
cron.schedule('10 * * * *', cronJobController.sendReminderNotification, { scheduled: true, timezone: 'Asia/Kolkata' });
cron.schedule('20 * * * *', cronJobController.sendReminderNotification, { scheduled: true, timezone: 'Asia/Kolkata' });
cron.schedule('30 * * * *', cronJobController.sendReminderNotification, { scheduled: true, timezone: 'Asia/Kolkata' });
I have to write a separate statement for every specific minute.
How can I achieve this in a single line of code?
Any help would be appreciated.
Thanks in advance.
Solution
This code should do what you wish, we can't run at minute 60, but we can run at minute 0 which should give you the same result:
cron.schedule('0,10,20,30,40,50 * * * *', cronJobController.sendReminderNotification, { scheduled: true, timezone: 'Asia/Kolkata' });
Answered By - Terry Lennox Answer Checked By - David Goodson (WPSolving Volunteer)