[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PID



On Sat, Jun 30, 2001 at 06:30:35PM -0600, Bob DeBolt wrote:
> Greetings to all
> 
> I have attempted to find a way to extract a PID for tcpdump
> so I can stop and archive the logs every day a 11:59 PM.
> 
> I want to run this in a shell script. Starting TCPDump and archiving is 
> functioning fine. I  simply need to get the PID so I can "kill -9 PID"
> and finish the process.

The best way to go is to save the PID when you start it up,

  #/bin/sh

  tcpdump -w tcpdump.dmp &
  echo $! > /var/run/tcpdump.pid

So when it comes time to stop,

  kill `cat /var/run/tcpdump.pid`

You are better off not using signal 9 (SIGKILL) unless you have to.
-- 
Crist J. Clark                           cjclark@alum.mit.edu