<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
So, for a newbie like me I might struggle with this one <span
class="moz-smiley-s2"><span> :-( </span></span><br>
<br>
I saw that the thread in comp.lang.python talks about a deamon flag for
a thread. This sounds like a idea that could work. I don't know how to
use that, but will use the example given there.<br>
<br>
Thanks.<br>
<br>
Kent Johnson wrote:
<blockquote cite="mid435F745C.6020104@tds.net" type="cite">
<pre wrap="">Johan Geldenhuys wrote:
</pre>
<blockquote type="cite">
<pre wrap="">I have script that calls a system command that I want to run for 5 minutes.
"""
import os
cmd = 'tcpdump -n -i eth0'
os.system(cmd)
"""
I can start a timer after the cmd is issued, but I don't know how to
send a control signal to stop the command after I issued it. This is
normally from the shell ^c.
</pre>
</blockquote>
<pre wrap=""><!---->
This is problematic. In general there is no clean way to kill a thread in Python. The usual approach is to set a flag which the thread checks but this won't work for you.
A recent thread in comp.lang.python has some discussion and suggestions but it is inconclusive:
<a class="moz-txt-link-freetext" href="http://groups.google.com/group/comp.lang.python/browse_frm/thread/94281f5a797489b1/ebca44930a016f74?q=os.system+thread&rnum=5&hl=en#ebca44930a016f74">http://groups.google.com/group/comp.lang.python/browse_frm/thread/94281f5a797489b1/ebca44930a016f74?q=os.system+thread&rnum=5&hl=en#ebca44930a016f74</a>
Kent
</pre>
</blockquote>
</body>
</html>