Merge pull request #1 from Unitech/development

Development
This commit is contained in:
Jun 2014-12-04 16:15:09 +08:00
commit 174ca2840b
6 changed files with 29 additions and 14 deletions

View File

@ -112,7 +112,7 @@ $ pm2 save
We're going to release a very nice product, a dashboard to monitor every part of your Node.js applications. Here are some links:
- [Register to Keymetrics I/O](https://keymetrics.io/)
- [Pitch + Survey](https://docs.google.com/forms/d/1FuCjIhrGg-ItxInq2nLreoe9GS-gZWJNkNWE0JJajw8/viewform) People who fill the survey will be eligible for free license
Thanks in advance and we hope that you like PM2!

View File

@ -1,6 +1,6 @@
var pm2 = require('..');
var pm2 = require('../..');
pm2.connect(function() {
pm2.delete('all', function() {

View File

@ -5,13 +5,13 @@ pm2.connect(function() {
pm2.delete('all', function() {
pm2.start('examples/axm/pm2_probe.js', function() {
pm2.start('examples/axm/pm2_agent_probe.js', function() {
pm2.start('examples/axm/event.js', function() {
pm2.start('examples/axm/http_app.js', {instances:4},function() {
pm2.start('examples/axm/event.js', {force:true}, function() {
pm2.start('examples/axm/http_app.js', {force:true, instances:4},function() {
pm2.start('examples/axm/probes.js',function() {
pm2.start('examples/axm/custom_action.js', function() {
pm2.start('examples/axm/custom_action_with_params.js', {name : 'custom'} , function() {
pm2.start('examples/axm/http_transaction.js', {name:'trace'}, function() {
pm2.start('examples/axm/throw.js', {name:'auto-throw', execMode : 'cluster_mode'}, function() {
pm2.start('examples/axm/custom_action.js', {force:true}, function() {
pm2.start('examples/axm/custom_action_with_params.js', {force:true, name : 'custom'} , function() {
pm2.start('examples/axm/http_transaction.js', {name:'trace', force:true}, function() {
pm2.start('examples/axm/throw.js', {name:'auto-throw', execMode : 'cluster_mode', force:true}, function() {
pm2.disconnect(function() { process.exit(1); });
});
});

View File

@ -902,7 +902,13 @@ CLI._operate = function(action_name, process_name, envs, cb) {
return next(new Error('Process not found'));
}
Satan.notifyGod('restart', id);
if (action_name == 'restartProcessId') {
Satan.notifyGod('restart', id);
} else if (action_name == 'deleteProcessId') {
Satan.notifyGod('delete', id);
} else if (action_name == 'stopProcessId') {
Satan.notifyGod('stop', id);
}
printOut(cst.PREFIX_MSG + action_name + ' process id %d', id);
return next();

View File

@ -10,8 +10,7 @@ var cluster = require('cluster');
var fs = require('fs');
var cst = require('../../constants.js');
var util = require('util');
var Common = require('../Common');
var Utility = require('../Utility.js');
var pkg = require('../../package.json');
/**
@ -62,9 +61,9 @@ module.exports = function ClusterMode(God) {
*********************************/
if (msg.data && msg.type) {
return God.bus.emit(msg.type ? msg.type : 'process:msg', {
at : Math.round(Date.now() / 1000),
at : Utility.getDate(),
data : msg.data,
process : Common.formatCLU(clu)
process : Utility.formatCLU(clu)
});
}
else {

View File

@ -7,7 +7,17 @@ var async = require('async');
var Utility = module.exports = {
getDate : function() {
return Math.round(Date.now() / 1000);
return Date.now();
},
formatCLU : function(process) {
if (!process.pm2_env) {
return process;
}
var obj = Utility.serialize(process.pm2_env);
delete obj.env;
return obj;
},
serialize : function(data) {
return JSON.parse(Stringify(data));