Skip to content

Instantly share code, notes, and snippets.

@petersirka petersirka/cpu.js
Created Dec 5, 2016

Embed
What would you like to do?
const Exec = require('child_process').exec;
var cmd = 'ps aux | grep "mysql" | grep -v "grep" | awk {\'print $2\'}';
Exec(cmd, function(err, response) {
var pid = response.trim();
cmd = 'ps -p {0} -o %cpu,rss,etime'.format(pid);
console.log(cmd);
Exec(cmd, function(err, response) {
console.log('---> POSLAT SIROVI:', arguments);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.