Browse Source

ps-node package added, experimental code to kill iguana process before starting new process is added. still debugging

ca333-dev
Satinder Grewal 8 years ago
parent
commit
7417ac48be
  1. 3
      package.json
  2. 28
      routes/shepherd.js

3
package.json

@ -31,6 +31,7 @@
"fs-extra": "^1.0.0",
"md5": "^2.2.1",
"mkdirp": "^0.5.1",
"pm2": "^2.3.0"
"pm2": "^2.3.0",
"ps-node": "^0.1.4"
}
}

28
routes/shepherd.js

@ -8,10 +8,12 @@ const fsnode = require('fs');
const fs = require('fs-extra');
const mkdirp = require('mkdirp');
const express = require('express');
const exec = require('child_process').exec;
const md5 = require('md5');
const pm2 = require('pm2');
Promise = require('bluebird');
const fixPath = require('fix-path');
var ps = require('ps-node');
var setconf = require("../private/setconf.js");
@ -152,6 +154,32 @@ function herder(flock, data) {
console.log('iguana flock selected...');
console.log('selected data: '+data);
//Make sure iguana isn't running before starting new process, kill it dammit!
// A simple pid lookup
/*ps.lookup({
command: 'iguana',
//arguments: '--debug',
}, function(err, resultList ) {
if (err) {
throw new Error( err );
}
resultList.forEach(function( process ){
if( process ){
console.log( 'PID: %s, COMMAND: %s, ARGUMENTS: %s', process.pid, process.command, process.arguments );
console.log(process.pid);
// A simple pid lookup
ps.kill( process.pid, function( err ) {
if (err) {
throw new Error( err );
}
else {
console.log( 'Process %s has been killed!', process.pid );
}
});
}
});
});*/
// MAKE SURE IGUANA DIR IS THERE FOR USER
mkdirp(iguanaDir, function (err) {
if (err)

Loading…
Cancel
Save