how to capture PID at execution time

From: Dan's generic account (ocalld@eads.com)
Date: Tue Mar 29 2005 - 14:24:14 EST


Hi all

Is it possible to capture the PID of a command at the time of execution and
write it to a log file???

I need to capture the PID at the time of execution, as several instances of
the command will be run at the same time, i need to make sure that the correct
process is killed when required.

an example would be having several instances httpd running.

running the httpd startup script produces the following output:
./scripts/httpd.sh 2>&1 |tee /var/log/jini.httpd.log &
[1] 1199
bash-2.03# Mar 29, 2005 8:28:05 PM com.sun.jini.tool.ClassServer run
INFO: ClassServer started [lib/dl/, port 8082]

the 1199 is the group process, so i could just use "kill -- -1199". any child
process die.
The above pipe to tee does not report the group PID. i just get the
following:

bash-2.03# cat /var/log/jini.httpd.log
Mar 29, 2005 8:28:05 PM com.sun.jini.tool.ClassServer run
INFO: ClassServer started [lib/dl/, port 8082]

how can i trap the PID?

Thanks
Dan.

The information contained within this e-mail and any files attached to this
e-mail is confidential and in addition may include commercially sensitive
information. The contents of this e-mail are for the intended recipient only
and therefore if you wish to disclose the information contained within this
e-mail or attached files, please contact the sender prior to any such
disclosure.
If you are not the intended recipient, any disclosure, copying or distribution
is prohibited. Please also contact the sender and inform them of the error and
delete the e-mail, including any attached files from your system.
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:30:26 EDT