發想自 node-schedule 的 node-schedule-server
node-schedule node-schedule是一個time base的排程器,透過給定簡單的時間物件或是給與cron job的時間格式字串,就可以指定時間觸發所給定的task。 這在Java的世界,與一套叫Quartz的服務相像... Github repository https://github.com/mattpat/node-schedule Installation npm install node-schedule Sample Usage 下面範例展示一個簡單的排程作業,其中date指定為現在時間過30秒,而date2指定為一個未來的時間... 程式起動時候,會先列印現在時間,並開始設定兩個(j, j2) Job分別在指定的date, date2時間啟動... var schedule = require('node-schedule'); var date = new Date(new Date().getTime() + 1*1000*30); var date2 = new Date('2015/1/31 21:28:00'); console.log(new Date()); console.log('j will start at:', date); var j = schedule.scheduleJob(date, function(){ console.log('The job j is going to end...'); }); console.log('j2 will start at:',date2); var j2 = schedule.scheduleJob(date2, function(){ console.log('The job j2 is going to end...'); }); 上面程式起動後,會執行列印現在時間,並且開始將Job置入排程時間,等候執行... $ node examples/node-schedule/sample01.js Sun Feb 01 2015 14:40:34 GMT+0800 (CST) j will s...