From 5a1cdc5facc4b5db48fcdb07d91936084caec7bb Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 20 Jul 2015 15:13:36 +0100 Subject: [PATCH] paleo cron --- .idea/sonarIssues.xml | 5 +++++ .idea/workspace.xml | 27 ++++++++++++++++++--------- cron.js | 12 ++++++++++++ paleo.js | 23 ++++++++++++++++++++--- 4 files changed, 55 insertions(+), 12 deletions(-) create mode 100644 cron.js diff --git a/.idea/sonarIssues.xml b/.idea/sonarIssues.xml index fd19825..27a6a62 100644 --- a/.idea/sonarIssues.xml +++ b/.idea/sonarIssues.xml @@ -8,6 +8,11 @@ + + + + + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 72c123a..9cbe5e8 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -54,18 +54,18 @@ - - + + - - + + - + @@ -146,6 +146,7 @@ @@ -1115,7 +1116,7 @@ - + @@ -1123,7 +1124,15 @@ - + + + + + + + + + @@ -1133,8 +1142,8 @@ - - + + diff --git a/cron.js b/cron.js new file mode 100644 index 0000000..a01da4d --- /dev/null +++ b/cron.js @@ -0,0 +1,12 @@ +var CronJob = require('cron').CronJob; +var job = new CronJob({ + cronTime: '0 0/60 * 1/1 * ? *', + onTick: function() { + // Runs every weekday (Monday through Friday) + // at 11:30:00 AM. It does not run on Saturday + // or Sunday. + }, + start: false, + timeZone: "America/Los_Angeles" +}); +job.start(); \ No newline at end of file diff --git a/paleo.js b/paleo.js index 500d344..005c197 100644 --- a/paleo.js +++ b/paleo.js @@ -1,7 +1,7 @@ -var RssBraider = require('rss-braider'), fs = require('fs'), +var RssBraider = require('rss-braider'), fs = require('fs'), CronJob = require('cron').CronJob, feeds = {}; -// Pull feeds from config files: +// Pull feeds from config files: , // feeds.simple_test_feed = require("./config/feed").feed; // Or define in-line feeds.simple_test_feed = { @@ -81,4 +81,21 @@ rss_braider.processFeed('simple_test_feed', 'rss', function(err, data){ console.log("The file was saved!"); }); -}); \ No newline at end of file +}); + + +var job = new CronJob({ + //cronTime: '0 0/60 * 1/1 * ? *', + + cronTime: '0 0/5 * 1/1 * ? *', + onTick: function() { + // Runs every hour + + console.log('Tick'); + + + }, + start: false, + timeZone: "America/Los_Angeles" +}); +job.start(); \ No newline at end of file