06-10-2002
As far as command line instruction goes I can only think of 'ps' command along with its various options but programatically each process can call getpid and getppid routines to know its and its parent pid. Moreover the parent process always knows the pids of its child when it spawns a child process.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Is there any build in command in unix to kill all the child process for a given process ID ? If any one has script or command, please let me know.
Thanks
Sanjay (4 Replies)
Discussion started by: sanjay92
4 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
This is not the same as a few of the other posted items dealing with sub-process pids (that I saw anyway).
If zot contains:
echo "main mypid: $$ - lastpid: $!"
(
echo "block mypid: $$ - lastpid: $! - ppid: $PPID"
ps -ef > xxx
sleep 5
echo "block mypid: $$ - lastpid: $! - ppid:... (6 Replies)
Discussion started by: MichLab
6 Replies
4. 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
5. UNIX for Dummies Questions & Answers
Hi,
I need to get the pid of a process and have to store the pid in a variable and i want to use this value(pid) of the variable for some process. Please can anyone tell me how to get the pid of a process and store it in a variable. please help me on this.
Thanks in advance,
Amudha (7 Replies)
Discussion started by: samudha
7 Replies
6. 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
7. Shell Programming and Scripting
Hi everyone
i am very new to linux , working on bash shell.
I am trying to solve the given problem
1. Create a process and then create children using fork
2. Check the Status of the application for successful running.
3. Kill all the process(threads) except parent and first child... (2 Replies)
Discussion started by: vizz_k
2 Replies
8. Red Hat
Hi ,
My problem is that I am not able to list all process id of any process.
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.
It is just listing the PPID and immediate child process id only. I... (4 Replies)
Discussion started by: pratapsingh
4 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
10. Shell Programming and Scripting
Hello,
I want to save pid of a child process but I get empty file.
su myuser -c "nohup ./mydaemon.sh >/dev/null 2>&1 & print $! > mydaemon.pid"
This one works:
nohup ./mydaemon.sh >/dev/null 2>&1 & print $! > mydaemon.pid
Please help. Thank you in advance. (2 Replies)
Discussion started by: vincegata
2 Replies
LEARN ABOUT FREEBSD
getppid
GETPID(2) BSD System Calls Manual GETPID(2)
NAME
getpid, getppid -- get parent or calling process identification
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <sys/types.h>
#include <unistd.h>
pid_t
getpid(void);
pid_t
getppid(void);
DESCRIPTION
The getpid() system call returns the process ID of the calling process. Though the ID is guaranteed to be unique, it should NOT be used for
constructing temporary file names, for security reasons; see mkstemp(3) instead.
The getppid() system call returns the process ID of the parent of the calling process.
ERRORS
The getpid() and getppid() system calls are always successful, and no return value is reserved to indicate an error.
SEE ALSO
fork(2), getpgrp(2), kill(2), setpgid(2), setsid(2), exec(3)
STANDARDS
The getpid() and getppid() system calls are expected to conform to ISO/IEC 9945-1:1990 (``POSIX.1'').
HISTORY
The getpid() function appeared in Version 7 AT&T UNIX.
BSD
November 2, 2006 BSD