From 09f5519dc9a4153a05b3e3eb2ce19aaa9f851bc1 Mon Sep 17 00:00:00 2001 From: Martin Donnelly Date: Tue, 9 Feb 2016 15:39:02 +0000 Subject: [PATCH] updates and fixes cron --- lot.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lot.js b/lot.js index f6656cd..dff291b 100644 --- a/lot.js +++ b/lot.js @@ -383,9 +383,7 @@ function prepareResults() { function saveData() { - jsonfile.writeFile(file, re, function (err) { - console.error(err); - }); + jsonfile.writeFileSync(file, re); } function sendEmail() { @@ -428,7 +426,7 @@ function processData(data) { } function GO() { - + re = []; resultsObj = {}; jsonfile.readFile(file, function (err, obj) { @@ -445,11 +443,10 @@ function GO() { console.log(resultsObj); sendEmail(); + saveData(); - }); - }); } @@ -460,6 +457,8 @@ function GO() { //sendEmail(); -cron.schedule('* 10 15 * * 2,5', function(){ +cron.schedule('1 00 18 * * 2,5', function(){ GO(); + // console.log('tick'); + return -1; });