I'm trying to monitor the CPU and RAM usage (in % of total for example) of a given process wich may spawn several processes. The parent process is /bin/rscw
so I get its pid by
ppid_bl=$(ps -ef | grep [b]in/rscw | awk '{print $2}')
and then I try something like
ps -ppid $ppid_bl S
(1)
because in man ps
it appears
-ppid Select by parent process ID. This selects the processes
with a parent process ID in pidlist. That is, it
selects processes that are children of those listed in
pidlist.
Output format S Sum up some information, such as CPU usage, from dead
child processes into their parent. This is useful for
examining a system where a parent process repeatedly
forks off short-lived children to do work.
My question is, is my approach right? I'm getting ps
error with (1), and this it's because I'm not using the right ps
syntax, but maybe I'm not doing things right even with a correct syntax.
Thanks for your time.