## node-schedule
- 安装
npm install node-schedule
cnpm install node-schedule
- 使用范围
规定在一天、一个星期、一个月,某一个特定的时间进行重复性的操作,加下来的每一天、每一个星期、每一个月都会进行一样的操作,在特定的时间。如果是在小范围时间内 例如 3 秒钟,每 3 秒钟进行一次重复的事情,就可以用setInterval();
- scheduleJob('* * * * * *', function(){})
'* * * * * *' 分别代表了 秒 分 时 日 月 每个星期的第几天
* * * * * *
┬ ┬ ┬ ┬ ┬ ┬
│ │ │ │ │ │
│ │ │ │ │ └ day of week (0 - 7) (0 or 7 is Sun)
│ │ │ │ └───── month (1 - 12)
│ │ │ └────────── day of month (1 - 31)
│ │ └─────────────── hour (0 - 23)
│ └──────────────────── minute (0 - 59)
└───────────────────────── second (0 - 59, OPTIONAL)
function 就代表这你使用的函数
/**
* 每分钟的 59 秒的时间 执行一次
*/
var jobs = Schedule.scheduleJob('59 * * * * *', function(){
console.log('The answer