Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const exec = require('child_process').exec;
const path = require('path');
const logger = require('../util/logger.js')(path.join(__dirname, "logs/cron_logs.txt"));
logger.info("Beginning color process nightly cron");
// Run the CSV processing script
logger.info("Processing Cooper-Hewitt color data");
const seneca = require('seneca')() // eslint-disable-line
.client({ type: 'tcp', pin: 'role:color', port: 10205 })
.act('role:color,cmd:process', () => {
logger.info("Exiting");
process.exit(0);
});
const seneca = require('seneca')({ // eslint-disable-line
transport: {
tcp: {
timeout: 60000,
},
},
})
.client({ type: 'tcp', pin: 'role:images', port: 10204, timeout: 60000 })
.act('role:images,cmd:tile', () => {
process.exit(0);
});
const path = require('path');
const logger = require('../util/logger.js')(path.join(__dirname, "logs/cron_logs.txt"));
const argv = require('minimist')(process.argv.slice(2));
const source = argv.d || path.resolve(__dirname, '../dashboard/public/output');
logger.info("Beginning nightly cron");
// Cleanup old CSVs
logger.info("Cleaning up old CSVs");
exec(['node', path.resolve(__dirname, './oldCSVClean.js'), '-d', source].join(' '));
// Run the CSV processing script
logger.info("Pulling latest from TMS");
const seneca = require('seneca')() // eslint-disable-line
.client({ type: 'tcp', pin: 'role:tmstocsv' })
.act('role:tmstocsv,cmd:runNightly', () => {
logger.info("Exiting");
process.exit(0);
});
var s = require('seneca')()
.client({ type: 'http', port: 8083 })
.client({ type: 'tcp', port: 8081, pin: 'cmd:enqueue-remote,queue:q1' })
.client({ type: 'tcp', port: 8082, pin: 'cmd:enqueue-remote,queue:q2' })
.use('..', {
queues: ['q1', 'q2']
})
s.act({ role: 'queue', cmd: 'enqueue', msg: { task: 'my task', param: 1 }})
s.act({ role: 'queue', cmd: 'enqueue', msg: { task: 'my task', param: 2 }})
s.act({ role: 'queue', cmd: 'enqueue', msg: { task: 'my task', param: 3 }})
s.act({ other: 'call' }, function(err, result) {
if (err) {
console.log(err)
process.exit(1)
}