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 .