Files
talk/bin/cli-jobs
T
Wyatt JohnsonandDan Zajdband b0f01cf00f Initial commit of asset queuing (#97)
* Initial commit of asset queuing

* Addresssing comments
2016-11-28 13:29:39 -05:00

50 lines
1.0 KiB
JavaScript
Executable File

#!/usr/bin/env node
/**
* Setup the debug paramater.
*/
process.env.DEBUG = process.env.TALK_DEBUG;
/**
* Module dependencies.
*/
const program = require('commander');
const scraper = require('../services/scraper');
const util = require('../util');
const mongoose = require('../mongoose');
util.onshutdown([
() => mongoose.disconnect()
]);
function processJobs() {
// Start the processor.
scraper.process();
// The scraper only needs to shutdown when the scraper has actually been
// started.
util.onshutdown([
() => scraper.shutdown()
]);
}
//==============================================================================
// Setting up the program command line arguments.
//==============================================================================
program
.command('process')
.description('starts job processing')
.action(processJobs);
program.parse(process.argv);
// If there is no command listed, output help.
if (process.argv.length <= 2) {
program.outputHelp();
util.shutdown();
}