Comparing version 0.6.12 to 0.6.13
@@ -172,3 +172,3 @@ | ||
if (platform === undefined) platform = ''; | ||
console.error(cst.PREFIX_MSG + 'sudo env PATH=$PATH:' + p.dirname(process.execPath) + ' pm2 startup ' + platform + '-u ' + stdout.trim()); | ||
console.error(cst.PREFIX_MSG + 'sudo env PATH=$PATH:' + p.dirname(process.execPath) + ' pm2 startup ' + platform + ' -u ' + stdout.trim()); | ||
process.exit(cst.ERROR_EXIT); | ||
@@ -175,0 +175,0 @@ }); |
@@ -117,6 +117,12 @@ /** | ||
case 'uncaughtException': | ||
God.bus.emit('process:exception', {process : clu, msg : msg.stack}); | ||
God.bus.emit('process:exception', {process : clu, data : msg.stack, err : msg.err}); | ||
break; | ||
case 'log:out': | ||
God.bus.emit('log:out', {process : clu, data : msg.data}); | ||
break; | ||
case 'log:err': | ||
God.bus.emit('log:err', {process : clu, data : msg.data}); | ||
break; | ||
default: // Permits to send message to external from the app | ||
God.bus.emit(msg.type ? msg.type : 'msg', msg); | ||
God.bus.emit(msg.type ? msg.type : 'process:msg', {process : clu, data : msg }); | ||
} | ||
@@ -703,1 +709,64 @@ }); | ||
}; | ||
/** | ||
* Send Message to Process by id or name | ||
*/ | ||
God.msgProcess = function(opts, cb) { | ||
var msg = opts.msg || {}; | ||
if ("id" in opts) { | ||
var id = opts.id; | ||
if (!(id in God.clusters_db)) | ||
return cb(new Error({msg : "PM ID unknown"}), {}); | ||
var proc = God.clusters_db[id]; | ||
if (proc.pm2_env.status == cst.ONLINE_STATUS) { | ||
/* | ||
* Send message | ||
*/ | ||
proc.send(msg); | ||
return cb(null, "message sent"); | ||
} | ||
else | ||
return cb(new Error({msg : "PM ID offline"}), {}); | ||
return false; | ||
} | ||
else if ("name" in opts) { | ||
/* | ||
* As names are not unique in case of cluster, this | ||
* will send msg to all process matching "name" | ||
*/ | ||
var name = opts.name; | ||
var arr = Object.keys(God.clusters_db); | ||
var sent = 0; | ||
(function ex(arr) { | ||
if (arr[0] == null) return cb(null, "sent " + sent + " messages"); | ||
var id = arr[0]; | ||
var proc_env = God.clusters_db[id].pm2_env; | ||
if (p.basename(proc_env.pm_exec_path) == name || proc_env.name == name) { | ||
if (proc_env.status == cst.ONLINE_STATUS) { | ||
God.clusters_db[id].send(msg); | ||
sent++; | ||
arr.shift(); | ||
return ex(arr); | ||
} | ||
} | ||
else { | ||
arr.shift(); | ||
return ex(arr); | ||
} | ||
return false; | ||
})(arr); | ||
} | ||
else return cb(new Error({msg : "method requires name or id field"}), {}); | ||
} |
@@ -27,5 +27,4 @@ // | ||
try { | ||
var currSize = 0; | ||
if (fs.statSync(path).size > 1000) | ||
currSize = fs.statSync(path).size; | ||
var currSize = fs.statSync(path).size - 1000; | ||
currSize = currSize > 0 ? currSize : 0; | ||
} catch(e) { | ||
@@ -39,6 +38,3 @@ if (e.code == 'ENOENT') | ||
fs.watch(path, function(ev, filename) { | ||
if (ev == 'rename') | ||
return console.error('Renaming file ?'); | ||
var _stream = function() { | ||
fs.stat(path, function(err, stat) { | ||
@@ -62,2 +58,11 @@ var prevSize = stat.size; | ||
}); | ||
} | ||
_stream() | ||
fs.watch(path, function(ev, filename) { | ||
if (ev == 'rename') | ||
return console.error('Renaming file ?'); | ||
_stream() | ||
return true; | ||
@@ -64,0 +69,0 @@ }); |
@@ -83,2 +83,6 @@ // ProcessContainer.js | ||
stderr.write(string); | ||
process.send({ | ||
type : 'log:out', | ||
data : string | ||
}); | ||
}; | ||
@@ -91,2 +95,6 @@ } | ||
stdout.write(string); | ||
process.send({ | ||
type : 'log:err', | ||
data : string | ||
}); | ||
}; | ||
@@ -101,3 +109,9 @@ })(process.stdout.write); | ||
type : 'uncaughtException', | ||
stack : err.stack | ||
stack : err.stack, | ||
err : { | ||
type: err.type, | ||
stack: err.stack, | ||
arguments: err.arguments, | ||
message: err.message | ||
} | ||
}); | ||
@@ -104,0 +118,0 @@ |
@@ -126,2 +126,3 @@ | ||
deleteProcessId : God.deleteProcessId, | ||
msgProcess : God.msgProcess, | ||
deleteAll : God.deleteAll | ||
@@ -128,0 +129,0 @@ }); |
{ | ||
"name": "pm2", | ||
"preferGlobal": "true", | ||
"version": "0.6.12", | ||
"version": "0.6.13", | ||
"engines" : { | ||
@@ -16,3 +16,6 @@ "node" : ">=0.8" | ||
"email" : "alex@kocharin.ru" | ||
}, { | ||
},{ | ||
"name" : "Ben Postlethwaite", | ||
"email" : "post.ben.here@gmail.com" | ||
},{ | ||
"name" : "Devo.ps", | ||
@@ -59,3 +62,3 @@ "email" : "contact@devo.ps" | ||
"dependencies": { | ||
"commander" : "2.0.0", | ||
"commander" : "2.1.0", | ||
"cli-table" : "0.2.0", | ||
@@ -62,0 +65,0 @@ "pm2-multimeter" : "0.1.2", |
@@ -5,13 +5,2 @@ # ![Monit](https://github.com/unitech/pm2/raw/master/pres/top-logo-wo.png) | ||
## pm2 related product incoming ! | ||
pm2 will always stay open source and we gonna create a product around pm2, a dashboard to monitor everything ! | ||
Help us to know your needs and if we are going on the right way : | ||
- [Pitch + Survey](https://docs.google.com/forms/d/1FuCjIhrGg-ItxInq2nLreoe9GS-gZWJNkNWE0JJajw8/viewform) People who fill the survey will get free license | ||
- [Newsletter](http://signup.pm2.io/) Subscribe to be kept informed | ||
Thanks in advance and we hope that you like pm2 ! | ||
## Tech notes | ||
@@ -42,2 +31,13 @@ | ||
# Monitoring dashboard | ||
![Dashboard](http://leapfrogui.com/controlfrog/img/cf-layout-1.png) | ||
We gonna release a very nice product, a dashboard to monitor every part of you NodeJS applications. Here are some links : | ||
- [Pitch + Survey](https://docs.google.com/forms/d/1FuCjIhrGg-ItxInq2nLreoe9GS-gZWJNkNWE0JJajw8/viewform) People who fill the survey will get free license | ||
- [Newsletter](http://signup.pm2.io/) Subscribe to be kept informed | ||
Thanks in advance and we hope that you like pm2 ! | ||
# Readme Contents | ||
@@ -44,0 +44,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
581006
93
2647
+ Addedcommander@2.1.0(transitive)
- Removedcommander@2.0.0(transitive)
Updatedcommander@2.1.0