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

29 lines
636 B
JavaScript

#!/usr/bin/env node
const CronJob = require('cron').CronJob;
// load env variables from file
require('dotenv').config();
const Malta = require('./ncas/mt');
async function run() {
const mtScraper = new Malta();
if (typeof(process.env.MT_CRON) === 'string' )
new CronJob(process.env.MT_CRON, async () => {
await mtScraper.run();
}, null, true);
if (process.env.SCRAPE_START === mtScraper.id)
await mtScraper.run();
console.log('scrapestart', process.env.SCRAPE_START);
console.log('MT Launched');
}
process.once('uncaughtException', function caught(err) {
console.error('Uncaught', err);
});
run();