nodejs-排程工具node-schedule

安裝

if you only want to do something like “run this function every 5 minutes”, toad-scheduler would be a better choice. But if you want to, say, “run this function at the :20 and :50 of every hour on the third Tuesday of every month

1
npm i node-schedule

每五分鐘執行一次

1
2
3
4
5
6
7
const schedule = require('node-schedule');
const { scheduleJob } = require('node-schedule');
const CRON_TIME=*/5 * * * *

const job = schedule.scheduleJob(CRON_TIME, function(){
console.log('每五分鐘你都會看到我');
});


本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!