Socket
Socket
Sign inDemoInstall

pm2

Package Overview
Dependencies
14
Maintainers
1
Versions
277
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.2 to 0.4.3

pres/pm2-htop.png

2

constants.js

@@ -17,3 +17,3 @@

DUMP_FILE_PATH : p.join(DEFAULT_FILE_PATH, 'dump.pm2'),
DAEMON_PORT : 66666,
DAEMON_BIND_ADDR : 'localhost:66666',
DEBUG : false,

@@ -20,0 +20,0 @@ WEB_INTERFACE : 9615,

@@ -19,3 +19,3 @@

l.opts.restart_time ? l.opts.restart_time : 0,
l.monit ? l.monit.memory : '',
l.monit ? UX.bytesToSize(l.monit.memory, 3) : '',
l.opts.fileError,

@@ -63,1 +63,23 @@ ];

};
UX.bytesToSize = function(bytes, precision) {
var kilobyte = 1024;
var megabyte = kilobyte * 1024;
var gigabyte = megabyte * 1024;
var terabyte = gigabyte * 1024;
if ((bytes >= 0) && (bytes < kilobyte)) {
return bytes + ' B';
} else if ((bytes >= kilobyte) && (bytes < megabyte)) {
return (bytes / kilobyte).toFixed(precision) + ' KB';
} else if ((bytes >= megabyte) && (bytes < gigabyte)) {
return (bytes / megabyte).toFixed(precision) + ' MB';
} else if ((bytes >= gigabyte) && (bytes < terabyte)) {
return (bytes / gigabyte).toFixed(precision) + ' GB';
} else if (bytes >= terabyte) {
return (bytes / terabyte).toFixed(precision) + ' TB';
} else {
return bytes + ' B';
}
};

@@ -25,4 +25,4 @@ // pm2-monitor // Code name : God

console.log("%s - id%d worker online",
clu.opts.pm_exec_path,
clu.pm_id);
clu.opts.pm_exec_path,
clu.pm_id);
God.clusters_db[clu.pm_id].status = 'online';

@@ -33,5 +33,5 @@ });

console.log('Script %s %d exited code %d',
clu.opts.pm_exec_path,
clu.pm_id,
code);
clu.opts.pm_exec_path,
clu.pm_id,
code);

@@ -46,5 +46,5 @@ God.clusters_db[clu.pm_id].status = 'starting';

if (clu.opts.max <= 0) {
God.clusters_db[clu.pm_id].status = 'stopped';
God.clusters_db[clu.pm_id].status = 'stopped';
delete God.clusters_db[clu.pm_id];
return ;
return ;
}

@@ -74,4 +74,4 @@ else clu.opts.max -= 1;

return God.stopProcess(processes[i], function() {
ex(processes, i - 1);
});
ex(processes, i - 1);
});
})(pros, l - 1);

@@ -111,6 +111,6 @@ };

arr.push({
pid : db[key].process.pid,
opts : db[key].opts,
pm_id : db[key].pm_id,
status : db[key].status
pid : db[key].process.pid,
opts : db[key].opts,
pm_id : db[key].pm_id,
status : db[key].status
});

@@ -197,9 +197,9 @@ }

if (i <= 0) {
if (cb != null) return cb(null, arr);
return true;
if (cb != null) return cb(null, arr);
return true;
}
return execute(JSON.parse(JSON.stringify(opts)), function(err, clu) { // deep copy
arr.push(clu);
ex(i - 1);
});
arr.push(clu);
ex(i - 1);
});
})(opts.instances);

@@ -206,0 +206,0 @@ }

@@ -7,18 +7,9 @@ //

var colors = [
'\x1B[34m',
'\x1B[36m',
'\x1B[32m',
'\x1B[35m',
'\x1B[31m',
'\x1B[30m',
'\x1B[90m',
'\x1B[33m',
'\x1B[34m',
'\x1B[36m',
'\x1B[32m',
'\x1B[35m',
'\x1B[31m',
'\x1B[30m',
'\x1B[90m',
'\x1B[33m'
'\x1B[34m', // blue
'\x1B[36m', // cyan
'\x1B[32m', // green
'\x1B[35m', // magenta
'\x1B[31m', // red
'\x1B[90m', // grey
'\x1B[33m', // yellow
];

@@ -45,3 +36,3 @@

var odb = db[title] = {color : colors[gl_idx++], l : 0};
var odb = db[title] = {color : colors[gl_idx++ % colors.length], l : 0};

@@ -70,9 +61,9 @@ fs.stat(path, function(err, stat) {

var rstream = fs.createReadStream(path, {
encoding : 'utf8',
start : currSize,
end : prevSize
encoding : 'utf8',
start : currSize,
end : prevSize
});
rstream.on('data', function(data) {
print_data(odb, title, data);
print_data(odb, title, data);
});

@@ -96,6 +87,6 @@

console.log(odb.color + '[%s (l%d)]\x1B[39m %s',
title,
odb.l++,
l);
title,
odb.l++,
l);
});
};

@@ -7,2 +7,3 @@ // pm2-htop

var os = require('os');
var CliUx = require('./CliUx');
var bars = {};

@@ -40,3 +41,3 @@

Monit.multi.write(proc.opts.script + ' [' + proc.pid + '] ' + ' \n\n');
var bar_cpu = Monit.multi(40, (i * 2) + 3 + i, {

@@ -91,3 +92,3 @@ width: 30,

scale,
bytesToSize(memory, 3));
CliUx.bytesToSize(memory, 3));
};

@@ -106,21 +107,1 @@

function bytesToSize(bytes, precision) {
var kilobyte = 1024;
var megabyte = kilobyte * 1024;
var gigabyte = megabyte * 1024;
var terabyte = gigabyte * 1024;
if ((bytes >= 0) && (bytes < kilobyte)) {
return bytes + ' B';
} else if ((bytes >= kilobyte) && (bytes < megabyte)) {
return (bytes / kilobyte).toFixed(precision) + ' KB';
} else if ((bytes >= megabyte) && (bytes < gigabyte)) {
return (bytes / megabyte).toFixed(precision) + ' MB';
} else if ((bytes >= gigabyte) && (bytes < terabyte)) {
return (bytes / gigabyte).toFixed(precision) + ' GB';
} else if (bytes >= terabyte) {
return (bytes / terabyte).toFixed(precision) + ' TB';
} else {
return bytes + ' B';
}
}

@@ -22,2 +22,5 @@ // God.

if (process.env.name != null)
process.title = 'pm2: ' + process.env.name;
exec(script, outFile, errFile);

@@ -24,0 +27,0 @@ })();

@@ -13,2 +13,20 @@

//
// Get host:port we should bind to
//
var bind = (function(addr) {
var hostport = String(addr).split(':');
if (hostport.length < 2) {
hostport = [undefined, hostport[0]];
}
if (hostport[0] == null) {
hostport[0] = 'localhost';
}
return {
HOST: hostport[0],
PORT: Number(hostport[1]),
}
})(cst.DAEMON_BIND_ADDR);
var Satan = module.exports = {};

@@ -28,5 +46,5 @@

Satan.pingDaemon(function(ab) {
if (ab == false)
return Satan.launchDaemon(Satan.launchRPC);
return Satan.launchRPC();
if (ab == false)
return Satan.launchDaemon(Satan.launchRPC);
return Satan.launchRPC();
});

@@ -50,5 +68,5 @@ }

process.stderr.write = (function(write) {
return function(string, encoding, fd) {
stdout.write(JSON.stringify([(new Date()).toISOString(), string]));
};
return function(string, encoding, fd) {
stdout.write(JSON.stringify([(new Date()).toISOString(), string]));
};
}

@@ -58,5 +76,5 @@ )(process.stderr.write);

process.stdout.write = (function(write) {
return function(string, encoding, fd) {
return function(string, encoding, fd) {
stdout.write(JSON.stringify([(new Date()).toISOString(), string]));
};
};
})(process.stdout.write);

@@ -75,3 +93,3 @@ }

rep.bind(cst.DAEMON_PORT);
rep.bind(bind.PORT, bind.HOST);

@@ -81,3 +99,3 @@ server.expose({

God.prepare(opts, function(err, clu) {
fn(null, stringifyOnce(clu, undefined, 0));
fn(null, stringifyOnce(clu, undefined, 0));
});

@@ -120,3 +138,3 @@ },

Satan.client = new rpc.Client(req);
Satan.ev = req.connect(cst.DAEMON_PORT);
Satan.ev = req.connect(bind.PORT);
Satan.ev.on('connect', function() {

@@ -191,3 +209,3 @@ process.emit('satan:client:ready');

});
req.connect(cst.DAEMON_PORT);
req.connect(bind.PORT);
};

@@ -204,3 +222,3 @@

if(obj===value){
printedObjIndex = index;
printedObjIndex = index;
}

@@ -216,5 +234,5 @@ });

if(replacer){
return replacer(key, value);
return replacer(key, value);
}else{
return value;
return value;
}

@@ -221,0 +239,0 @@ }

{
"name": "pm2",
"preferGlobal": "true",
"version": "0.4.2",
"version": "0.4.3",
"engines" : {
"node" : ">=0.8"
},
"author": {
"name": "Strzelewicz Alexandre",
"email": "strzelewicz.alexandre@gmail.com",
"url": "http://apps.hemca.com"
},
"contributors": [{
"name" : "Alex Kocharin",
"email" : "alex@kocharin.ru"
}],
"homepage" : "http://unitech.io/",

@@ -51,8 +60,3 @@ "description": "The next generation process manager for Node.js with native clusterization",

},
"author": {
"name": "Strzelewicz Alexandre",
"email": "strzelewicz.alexandre@gmail.com",
"url": "http://apps.hemca.com"
},
"license": "MIT"
}

@@ -27,3 +27,4 @@ ![Monit](https://github.com/unitech/pm2/raw/master/pres/pm2.png)

$ pm2 dump // Dump the states of all processes
$ pm2 stop // Stop all processes
$ pm2 stop pm2_id // Stop specific process id
$ pm2 stopAll // Stop all processes
$ pm2 resurect // Put online previously dumped processes

@@ -30,0 +31,0 @@ $ pm2 restart // Restart all proccesses

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc