Answer the question
In order to leave comments, you need to log in
Error: TERM environment variable not set?
Good day!
There is a bash script in which the command is executed in one of the places
echo `top -n1 | grep Cpu | awk '{print $2}'` >> $PWD'/logs/meter-proc.log'
$descriptorspec = array(0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("file", "logs/error-output.log", "a"));
$process = proc_open(__DIR__.'/meter.sh', $descriptorspec, $pipes);
Answer the question
In order to leave comments, you need to log in
To run top, you must use a pseudo/or/terminal (/dev/(p)tty), otherwise the termcap library will not be able to run on it. How to start a process in php using pseudo-terminal - I don't know.
Or install sar (sysstat) and use the mpstat utility.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question