24 lines
486 B
JavaScript
24 lines
486 B
JavaScript
#!/usr/bin/env node
|
|
const CronJob = require('cron').CronJob;
|
|
|
|
// load env variables from file
|
|
require('dotenv').config();
|
|
|
|
const Norway = require('./ncas/no');
|
|
|
|
async function run() {
|
|
const noScraper = new Norway();
|
|
|
|
if (typeof(process.env.NO_CRON) === 'string' )
|
|
new CronJob(process.env.NO_CRON, async () => {
|
|
await noScraper.run();
|
|
}, null, true);
|
|
|
|
if (process.env.SCRAPE_START === noScraper.id)
|
|
await noScraper.run();
|
|
|
|
console.log('NO Launched');
|
|
}
|
|
|
|
run();
|