24 lines
493 B
JavaScript
24 lines
493 B
JavaScript
#!/usr/bin/env node
|
|
const CronJob = require('cron').CronJob;
|
|
|
|
// load env variables from file
|
|
require('dotenv').config();
|
|
|
|
const Belgium = require('./ncas/be');
|
|
|
|
async function run() {
|
|
const beScraper = new Belgium();
|
|
|
|
if (typeof(process.env.BE_CRON) === 'string' )
|
|
new CronJob(process.env.BE_CRON, async function() {
|
|
await beScraper.run();
|
|
}, null, true);
|
|
|
|
if (process.env.SCRAPE_START === beScraper.id)
|
|
await beScraper.run();
|
|
|
|
console.log('BE launched');
|
|
}
|
|
|
|
run();
|