1

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.

1

I have to use two dashes for this parameter, like

$ ps --ppid 1

My version:

$ ps --version
procps-ng version 3.3.4
  • Indded, ps -o pcpu,pmem,pid,user,cmd --ppid 1 did the thing. Thank you. – Jorge Lavín Apr 2 '14 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.