#!/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();