Home > Article > Web Front-end > Node.js node-schedule scheduled task execution method every few minutes_node.js
In Node.js, I use node-schedule to execute scheduled tasks. The Cron-style time format is not intuitive for beginners, so this method is generally used: For example, in the official example, the task is executed at 42 minutes per hour
var rule = new schedule.RecurrenceRule();
rule.minute = 42;
var j = schedule.scheduleJob(rule, function(){
console.log('The answer to life, the universe, and everything!');
});
The key thing is that rule.minute supports arrays. Knowing this will make it easy to operate
Execute every 15 minutes: