I want to execute task based on time so i am using node-schedule
to run every 1 minute for now but i dont see anything in console, Any idea what is implemented wrong ?
cron.js
var cron = require('node-schedule');
cron.scheduleJob('*/1 * * * * *', function() {
console.log('This runs at the 30th mintue of every hour. FROM NODE SCHEDULE');
async.eachSeries(directories, function(dir, cb1) {
var dir = __dirname + dir;
console.log('reading', dir);
// get files for the directory
fs.readdir(dir, function(err, files) {
if (err) return cb1(err);
// loop through each file
async.eachSeries(files, function(file, cb2) {
var filePath = path.resolve(dir + '/' + file);
// get info for the file
fs.stat(filePath, function(err, stats) {
if (err) return cb2(err);
var fileInfo = {
fileDate: stats.birthtime,
filename: file
};
console.log('fileInfo', fileInfo);
compareDates(fileInfo, filePath);
cb2(null, fileInfo);
});
}, cb1);
});
});
});
via hussain
No comments:
Post a Comment