how to show cpu usage ,mem usage , uptime for a child processes of a process

SA

I was asked by a developer to make a small script that take the ppid as a parameter then print and log some info about any child processes that it will fork .

 

I used simply this line

ps -o etime,pcpu,pmem –ppid [parent process id ]

ps is a command that can be used to print some info about systems processes (Process State)

-o is a nice option which we tell what do we need to print about the process …

here I used:

etime : to show the up time

pcpu :  to show the cpu usage

pmem : to show the memory usage

 

all what I had to do next is to use this command in a simple script depending on our  requirements .

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s