changedetection/rc.js
Martin Donnelly 9858a90912 init
2019-10-21 23:38:27 +01:00

34 lines
703 B
JavaScript

#!/usr/bin/env node
const CronJob = require('cron').CronJob;
// load env variables from file
require('dotenv').config();
const Ireland = require('./scrapers/rc');
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)
{
console.log('go');
await ieScraper.run();
}
console.log('RC Launched');
}
process.once('uncaughtException', function caught(err) {
console.error('Uncaught', err);
});
run();