I would recommend node-cron . It allows you to run tasks using Cron templates, for example.
'* * * * * *' - runs every second '*/5 * * * * *' - runs every 5 seconds '10,20,30 * * * * *' - run at 10th, 20th and 30th second of every minute '0 * * * * *' - runs every minute '0 0 * * * *' - runs every hour (at 0 minutes and 0 seconds)
But also more complicated schedules, for example
'00 30 11 * * 1-5' - Runs every weekday (Monday through Friday) at 11:30:00 AM. It does not run on Saturday or Sunday.
Code example : work is done every 10 minutes:
var cron = require('cron'); var cronJob = cron.job("0 */10 * * * *", function(){
You can find more examples in the node-cron wiki
More information on cron configuration can be found on the cron wiki
I use this library in many projects and it does the job. Hope this helps.
Tom Dec 10 '13 at 16:13 2013-12-10 16:13
source share