Comparing version 0.4.5 to 0.4.6
@@ -12,3 +12,3 @@ // God. | ||
var fs = require('fs'); | ||
var worker = require('cluster').worker; | ||
var worker = require('cluster').worker; | ||
@@ -20,5 +20,9 @@ var outFile = process.env.pm_out_log_path; | ||
var script = process.env.pm_exec_path; | ||
fs.writeFileSync(pidFile, process.pid); | ||
// Add args to process if args specified on start | ||
if (process.env.args != null) | ||
process.argv = process.argv.concat(process.env.args.split(' ')); | ||
// Rename process | ||
if (process.env.name != null) | ||
@@ -25,0 +29,0 @@ process.title = 'pm2: ' + process.env.name; |
{ | ||
"name": "pm2", | ||
"preferGlobal": "true", | ||
"version": "0.4.5", | ||
"version": "0.4.6", | ||
"engines" : { | ||
@@ -18,3 +18,3 @@ "node" : ">=0.8" | ||
"homepage" : "http://unitech.io/", | ||
"description": "The next generation process manager for Node.js with native clusterization", | ||
"description": "The next generation process manager for Node.js with native clusterization ", | ||
"main": "index.js", | ||
@@ -21,0 +21,0 @@ "scripts": { |
@@ -24,3 +24,2 @@ ![Monit](https://github.com/unitech/pm2/raw/master/pres/pm2.png) | ||
// the right numbers of processes depending of CPUs | ||
$ pm2 list // Display all processes status | ||
@@ -40,2 +39,14 @@ $ pm2 monit // Monitor all processes | ||
## Differents way of starting a process | ||
``` | ||
$ pm2 start app.js -i max // Will start maximum processes depending on CPU availables | ||
$ pm2 start app.js -i 3 // Will start 3 processes | ||
$ pm2 start app.json // Start processes with options declared in app.json | ||
// Go to chapter Multi process JSON declaration for more | ||
$ pm2 start app.js -i max -- -a 23 // Pass arguments after -- to app.js | ||
$ pm2 start app.js -i max -e err.log -o out.log -w // Will start and generate a configuration file | ||
``` | ||
## pm2 list | ||
@@ -95,13 +106,14 @@ | ||
[{ | ||
"name" : "echo", | ||
"script" : "./examples/echo.js", | ||
"max" : "10", | ||
"args" : "-d 1" | ||
"name" : "echo", | ||
"script" : "./examples/echo.js", | ||
"max" : "10", | ||
"instances" : "max", | ||
"args" : "-d 1" | ||
},{ | ||
"name" : "api", | ||
"script" : "./examples/child.js", | ||
"name" : "api", | ||
"script" : "./examples/child.js", | ||
"instances" : "4" | ||
},{ | ||
"name" : "bus", | ||
"script" : "./examples/echokill.js" | ||
"name" : "bus", | ||
"script" : "./examples/echokill.js" | ||
}] | ||
@@ -108,0 +120,0 @@ ``` |
@@ -65,7 +65,7 @@ | ||
God.prepare({ | ||
pm_exec_path : path.resolve(process.cwd(), 'test/fixtures/echo.js'), | ||
pm_exec_path : path.resolve(process.cwd(), 'test/fixtures/echo.js'), | ||
pm_err_log_path : path.resolve(process.cwd(), 'test/errLog.log'), | ||
pm_out_log_path : path.resolve(process.cwd(), 'test/outLog.log'), | ||
pm_pid_path : path.resolve(process.cwd(), 'test/child'), | ||
instances : 3 | ||
pm_pid_path : path.resolve(process.cwd(), 'test/child'), | ||
instances : 3 | ||
}, function(err, procs) { | ||
@@ -80,7 +80,7 @@ God.getFormatedProcesses().length.should.equal(3); | ||
God.prepare({ | ||
pm_exec_path : path.resolve(process.cwd(), 'test/fixtures/echo.js'), | ||
pm_exec_path : path.resolve(process.cwd(), 'test/fixtures/echo.js'), | ||
pm_err_log_path : path.resolve(process.cwd(), 'test/errLog.log'), | ||
pm_out_log_path : path.resolve(process.cwd(), 'test/outLog.log'), | ||
pm_pid_path : path.resolve(process.cwd(), 'test/child'), | ||
instances : 'max' | ||
pm_pid_path : path.resolve(process.cwd(), 'test/child'), | ||
instances : 'max' | ||
}, function(err, procs) { | ||
@@ -93,2 +93,18 @@ God.getFormatedProcesses().length.should.equal(numCPUs); | ||
it('should handle arguments', function(done) { | ||
God.prepare({ | ||
pm_exec_path : path.resolve(process.cwd(), 'test/fixtures/args.js'), | ||
pm_err_log_path : path.resolve(process.cwd(), 'test/errLog.log'), | ||
pm_out_log_path : path.resolve(process.cwd(), 'test/outLog.log'), | ||
pm_pid_path : path.resolve(process.cwd(), 'test/child'), | ||
args : '-d -a', | ||
instances : '1' | ||
}, function(err, procs) { | ||
setTimeout(function() { | ||
God.getFormatedProcesses()[0].opts.restart_time.should.eql(0); | ||
God.stopAll(done); | ||
}, 400); | ||
}); | ||
}); | ||
}); | ||
@@ -95,0 +111,0 @@ |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
444978
51
1140
176
22