To install:
npm install --save ps-man
- list
- name : Process name - optional
- pid : Process identifier - optional
- clean : boolean to return clean list for mac - optional
- kill
- pidList : Array of process identifier - mandatory
- signal : The default signal for kill is TERM. (see
man ps
) - optional - OSX/Linux only
var ps = require('ps-man');
// Filter by name
var options = {
name: 'node'
};
ps.list(options, function(err, result) {
// my stuff here
});
var ps = require('ps-man');
// Filter by pid
var options = {
pid: 1501
};
ps.list(options, function(err, result) {
// my stuff here
});
var ps = require('ps-man');
// Filter by pid
var options = {
clean: true
};
ps.list(options, function(err, result) {
// my stuff here
});
var ps = require('ps-man');
var options = {
pidList: ['1501'],
signal: '-9'
};
ps.kill(options, function(err) {
// stuff here
});
// or could be used as following
ps.kill(['1501'], function(err) {
// stuff here
});
MIT. Please see License file for more details.