<br><br><div><span class="gmail_quote"></span>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div link="blue" vlink="purple" lang="EN-GB"><div>

<p><span style="font-size: 10pt;">file('/var/lock/Application.lock',
'w').write(str(os.getpid()))</span></p>



<p><span style="font-size: 10pt;"> </span>Which to be honest appears to run just fine, when I look in
that file it always contains the correct process ID, for instance, 3419 or something
like that.</p></div></div></blockquote><div>I honestly doubt that. The I/O is buffered and you need to flush()/close() the file. Otherwise data may not get written until python interpreter exits.<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-GB"><div><p style=""><span style="font-size: 10pt;">      if
file('/proc/%s/cmdline' % pid).read().endswith('python'):</span></p>

<p><span style="font-size: 10pt;">            os.system('kill
%s' % pid)</span></p></div></div></blockquote><div>Are you sure about endswith('python')?<br>Maybe you need find('python') != -1.<br><br></div></div>-- <br>Regards,<br>Arvind