Hi ,
My problem is that I am not able to list all process id of any process.
Quote:
[root@server public_html]# pstree -p | grep httpd
|-httpd(17888)-+-httpd(9134)
| |-httpd(9136)-+-{httpd}(9140)
| | |-{httpd}(9141)
| | |-{httpd}(9142)
| | |-{httpd}(9143)
| | |-{httpd}(9144)
| | `-{httpd}(9145)
| `-httpd(12594)-+-{httpd}(12596)
| |-{httpd}(12597)
| |-{httpd}(12598)
| |-{httpd}(12599)
| |-{httpd}(12600)
| `-{httpd}(12601)
If you see pstree command it shows many process id under https. But if I run ps command its not listing all the process id for httpd.
Quote:
[root@server public_html]# ps auwx | grep http | grep -v grep
apache 9134 0.0 1.3 46544 10060 ? S 16:36 0:00 /usr/local/apache/bin/httpd -k restart
apache 9136 0.0 6.1 149656 47728 ? Sl 16:36 0:01 /usr/local/apache/bin/httpd -k restart
apache 12594 0.0 2.0 114180 16040 ? Sl 19:51 0:00 /usr/local/apache/bin/httpd -k restart
root 17888 0.0 1.7 46676 13256 ? Ss Mar22 0:05 /usr/local/apache/bin/httpd -k restart
It is just listing the PPID and immediate child process id only. I want to have all child process id.
Why pstree and ps command output is different.
Can someone point me in the right direction so that I can get all the child process id using other command rather than using pstree command.
Thank you
---------- Post updated at 09:08 PM ---------- Previous update was at 09:08 PM ----------
I have managed to write one line script to get the list all process id of HTTPD including PPID TGID and PID
Quote:
for i in `ps auwx | grep http | grep -v grep | awk {'print $2'}`; do ls -1 /proc/$i/task ; done