On Wed, 4 Sep 2019 12:29:38 +0200 "Carlos E. R." <robin.listas@telefonica.net> wrote:
On 04/09/2019 11.52, Per Jessen wrote:
Per Jessen wrote:
Carlos E. R. wrote:
On 04/09/2019 11.08, Per Jessen wrote:
Carlos E. R. wrote:
Hi,
Can I find the percent of cpu load for a process inside a script?
At worst, I can find it out from "top", but I wonder if there is a more direct way.
run that process with 'time' ?
Nono. I want, in a script, to find the cpu load value of a different program, at many times.
Yes, so run _that_ program with 'time'.
I.e. inside your script:
#!/bin/bash do this do that time do more do something else do something entirely different.
Again, no. That's the load at the end. I want to monitor a daemon, clamd, at any point. Instant CPU load.
"top" must obtain the data from somewhere. I want to obtain the same data top does, with calling another program. If there is no other way, I'll use top and parse the output.
What about `ps'? E.g.: steve [ ~ ]$ ps -q $(pidof emacs) -o pcpu,comm %CPU COMMAND 0.3 emacs Steve Berman -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org