我正在使用node-cron来使用cron。
这是我到目前为止所做的 -
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' });
我必须为每一特定分钟写一份单独的声明。
如何通过一行代码实现此目的?
任何帮助将不胜感激。
提前致谢。
最佳答案
您可以使用'*/10 * * * *'
所以试试吧
cron.schedule('*/10 * * * *', cronJobController.sendReminderNotification, { scheduled: true, timezone: 'Asia/Kolkata' });
关于node.js - 在 Node js 中每小时每 10、20、30、40、50、60 分钟运行一次 cron 作业,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66170621/