29 lines
627 B
JavaScript
29 lines
627 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 Denmark = require('./ncas/dkV2');
|
|
|
|
async function run() {
|
|
const dkScraper = new Denmark();
|
|
|
|
if (typeof(process.env.DK_CRON) === 'string' )
|
|
new CronJob(process.env.DK_CRON, async function() {
|
|
await dkScraper.run();
|
|
}, null, true);
|
|
|
|
if (process.env.SCRAPE_START === dkScraper.id)
|
|
await dkScraper.run();
|
|
console.log('DK Launched');
|
|
}
|
|
|
|
process.once('uncaughtException', function caught(err) {
|
|
console.error('Uncaught', err);
|
|
});
|
|
|
|
run();
|