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