03-27-2012
Listing all child pid and deleting it in reverse order
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
9 More Discussions You Might Find Interesting
1. Programming
Hi,
Can anybody solve this query?
A parent process forks 2 child processes. How does the child process know it's PID without the parent process sending it.
Apart from the "ps-ef" option, what other options are there if any? (2 Replies)
Discussion started by: skannan
2 Replies
2. Programming
question: for the below program
i just printed the value for pid, child pid and parent pid
why does it give me 6 values? i assume ppid is 28086
but can't figure out why there are 5 values printed instead of just two!
can someone comment on that!
#include<stdio.h>
#define DIM 8
int... (3 Replies)
Discussion started by: a25khan
3 Replies
3. Shell Programming and Scripting
I am using ZSH shell in Linux.
I am calling a child program in background mode parallely (say 2-3 threads). I have problem in handling the temporary files of these child programs since the temp file names are unique for all the child process.
To distinguish i want to use the pid in the temp... (3 Replies)
Discussion started by: dhams
3 Replies
4. UNIX for Dummies Questions & Answers
I need to sort the particular column only in reverse order how i can give it..
if i give the -r option the whole file is getting sorted in reverse order.
1st 2nd col 3rd
C col 4th col 5th col
-------------------------------------------
C... (7 Replies)
Discussion started by: sivakumar.rj
7 Replies
5. Shell Programming and Scripting
Hi,
I'm looking for a method where we can capture the PID and if possible the progress of child process especially the ones running in background.
can anyone help? (6 Replies)
Discussion started by: aman jain
6 Replies
6. Shell Programming and Scripting
i am having lines like below seperated by "|" (pipe)
abc|xyz
123|567
i have to get the above in reverse order
xyz|abc
567|123
Pls help (5 Replies)
Discussion started by: suryanarayana
5 Replies
7. Homework & Coursework Questions
1. The problem statement, all variables and given/known data:
I need to make an program that in a loop creates one parent and five children with fork(). The problem i'm trying to solve is how to delete the parent and child of the childīs process.
2. Relevant commands, code, scripts,... (0 Replies)
Discussion started by: WhiteFace
0 Replies
8. Shell Programming and Scripting
Hi,
I want to print the item in reverse order such that the output would look like
00 50 50 23 40 22 02 96
Below is the input:
00 05 05 32 04 22 20 69
Video tutorial on how to use code tags in The UNIX and Linux Forums. (5 Replies)
Discussion started by: reignangel2003
5 Replies
9. Shell Programming and Scripting
HI
Am trying to get child process id for a PID using ksh..
ps -ef | grep xntpd
root 3342472 2228308 0 12:17:40 - 0:00 /usr/sbin/xntpd
root 4522024 6488316 0 12:18:56 pts/0 0:00 grep xntpd
root 6291614 3342472 0 12:17:40 - 0:00 /usr/sbin/xntpd
Here now i... (1 Reply)
Discussion started by: Priya Amaresh
1 Replies
LEARN ABOUT REDHAT
apacheconf
apacheconf(1) Apache configuration apacheconf(1)
NAME
apacheconf - Apache configuration utility
SYNTAX
apacheconf
DESCRIPTION
This is a new graphical tool to configure the common web server Apache in an easy and simple way. It supports the basic configuration
options and even allows to set up multiple virtual hosts.
OPTIONS
None
FILES
/usr/bin/apacheconf
/usr/share/apacheconf/*
/etc/alchemist/switchboard/apache.switchboard.adl
/etc/alchemist/namespace/apache/local.adl
/etc/alchemist/namespace/apache/rpm.adl
/var/cache/alchemist/apache/*
EXAMPLES
To run this program simply type:
apacheconf
SEE ALSO
httpd(8)
BUGS
Not all possible checks for correct values are done yet.
The current /etc/httpd/conf/httpd.conf file is NOT parsed, so changing the configuration with apacheconf will overwrite any manual changes
to the httpd.conf file or the changes done with apacheconf are discarded. In case of overwriting the manually editied file a backup file
will be generated.
AUTHORS
Jonathan Blandford <jrb@redhat.com>
Philipp Knirsch <pknirsch@redhat.com>
Philipp Knirsch 0.63 apacheconf(1)