obdfcascrape/ie.js
Martin Donnelly be5d3eae07 init
2019-05-05 20:13:56 +01:00

31 lines
668 B
JavaScript

#!/usr/bin/env node
const CronJob = require('cron').CronJob;
// load env variables from file
require('dotenv').config();
const Ireland = require('./ncas/ie');
async function run() {
const ieScraper = new Ireland();
if (typeof(process.env.IE_CRON) === 'string' ) {
console.log(`${ieScraper.id} cron set for ${process.env.IE_CRON}`);
new CronJob(process.env.IE_CRON, async function() {
await ieScraper.run();
}, null, true);
}
if (process.env.SCRAPE_START === ieScraper.id)
await ieScraper.run();
console.log('IE Launched');
}
process.once('uncaughtException', function caught(err) {
console.error('Uncaught', err);
});
run();