R
Ray
I'm running python 2.4 on linux. I use python os.fork run tcpdump, but
after I kill the forked process (tcpdump) in linux it shows defunct
here is the code:
#!/usr/bin/python
import time, os
class Test:
def fork(self):
self.pid=os.fork()
if self.pid=0:
args=['tcpdump', '-i', 'eth0', 'port', '80' '']
os.execl("/usr/sbin/tcpdump", *args)
os._exit(0)
def kill(self):
os.kill(self.pid, 15)
if __name__=='__main__':
while True:
test=Test()
test.fork()
time.sleep(2)
test.kill()
time.sleep(30)
after I call kill() it will kill tcpdump (capture will stop) but on
linux, ps shows tcpdump as defunct process
what am I missing?
thanks for any help.
after I kill the forked process (tcpdump) in linux it shows defunct
here is the code:
#!/usr/bin/python
import time, os
class Test:
def fork(self):
self.pid=os.fork()
if self.pid=0:
args=['tcpdump', '-i', 'eth0', 'port', '80' '']
os.execl("/usr/sbin/tcpdump", *args)
os._exit(0)
def kill(self):
os.kill(self.pid, 15)
if __name__=='__main__':
while True:
test=Test()
test.fork()
time.sleep(2)
test.kill()
time.sleep(30)
after I call kill() it will kill tcpdump (capture will stop) but on
linux, ps shows tcpdump as defunct process
what am I missing?
thanks for any help.