30 lines
626 B
JavaScript
30 lines
626 B
JavaScript
#!/usr/bin/env node
|
|
const CronJob = require('cron').CronJob;
|
|
|
|
// load env variables from file
|
|
require('dotenv').config();
|
|
|
|
const argv = require('yargs').argv;
|
|
|
|
const Germany = require('./ncas/de');
|
|
|
|
async function run() {
|
|
const deScraper = new Germany();
|
|
|
|
if (typeof(process.env.DE_CRON) === 'string' )
|
|
new CronJob(process.env.DE_CRON, async function() {
|
|
await deScraper.run();
|
|
}, null, true);
|
|
|
|
if (process.env.SCRAPE_START === deScraper.id)
|
|
await deScraper.run();
|
|
|
|
console.log('DE Launched');
|
|
}
|
|
|
|
process.once('uncaughtException', function caught(err) {
|
|
console.error('Uncaught', err);
|
|
});
|
|
|
|
run();
|