how to capture PID at execution time

From: Dan's generic account (ocalld_at_eads.com)
Date: 03/29/05

  • Next message: Olsen, Richard (Cont, ARL/CISD): "SU - gets No directory error, but it is there"
    To: "Sunmanagers LIST" <sunmanagers@sunmanagers.org>
    Date: Tue, 29 Mar 2005 20:24:14 +0100
    
    

    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


  • Next message: Olsen, Richard (Cont, ARL/CISD): "SU - gets No directory error, but it is there"

    Relevant Pages

    • Re: how to delete a DLL beeing used by windows?
      ... ListDLLs V2.23 - DLL lister for Win9x/NT ... WINLOGON.EXE pid: 164 ... Command line: winlogon.exe ... > "Dimitriy Braslavskiy" wrote in message ...
      (microsoft.public.win2000.security)
    • Re: IPC
      ... You want to use the system command here ... ... Pid in perl script are different from Pid in bash and so I can't kill them and I can't wait for them. ... 19992 pts/1 00:00:00 example.pl ... 20001 pts/1 00:00:00 sh child process 19993 finished, ...
      (comp.lang.perl.misc)
    • Re: Wait for background processes to complete
      ... trying to use the shell concepts and maximize parallelism). ... the systemcommand - which leaves us back at square one. ... fork, and then do your own wait. ... PID PGID COMMAND ...
      (comp.lang.perl.misc)
    • Re: IPC
      ... >>>....don't return the pid of the subprocess! ... This is a nasty command that attempts to fill up your disk with a file ... Yes, you are correct in that the open command launches a shell process, ...
      (comp.lang.perl.misc)
    • Re: [opensuse] Help Killling Process
      ... will not die nor will it display anything. ... I remember from the 'old days' that there is a cli command to ... identify a process id and another one to kill a process. ... This will give you a listing of the processes and their pid' although ...
      (SuSE)