has anyone around here looked at the linux &#39;supervise&#39; stuff to accomplish this? <br><br><a href="http://cr.yp.to/daemontools.html">http://cr.yp.to/daemontools.html</a><br><br>~s<br><br><div class="gmail_quote">On Wed, Sep 23, 2009 at 12:43 PM, Brent Pedersen <span dir="ltr">&lt;<a href="mailto:bpederse@gmail.com">bpederse@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">On Wed, Sep 23, 2009 at 12:02 PM, Benjamin Sergeant &lt;<a href="mailto:bsergean@gmail.com">bsergean@gmail.com</a>&gt; wrote:<br>

&gt; Hi there,<br>
&gt;<br>
&gt; I figured out this morning that I had a long-running process that died<br>
&gt; one week ago for some obscure reasons. I made a little script that<br>
&gt; restarts a script when the called script die. I know there are already<br>
&gt; existing stuff doing that but I could not remember the name / find any<br>
&gt; existing ones  ... so why not re-inventing the wheel one more time :)<br>
&gt;<br>
&gt; Thanks for any feedback,<br>
&gt; - Benjamin<br>
&gt;<br>
&gt; <a href="http://code.activestate.com/recipes/576911/" target="_blank">http://code.activestate.com/recipes/576911/</a><br>
&gt; #!/usr/bin/env python<br>
&gt;<br>
&gt; import sys<br>
&gt; import time<br>
&gt; import subprocess<br>
&gt;<br>
&gt; &quot;&quot;&quot;<br>
&gt; Keep a process up and running<br>
&gt;<br>
&gt; If you have a long running process that can be killed for strange and unknown<br>
&gt; reason, you might want it to be restarted ... this script does that.<br>
&gt;<br>
&gt; $ cat alive.sh<br>
&gt; #!/bin/sh<br>
&gt;<br>
&gt; while `true`; do echo Alive &amp;&amp; sleep 3 ; done<br>
&gt;<br>
&gt; Use it like this:<br>
&gt; $ keepup.py ./alive.sh<br>
&gt; &quot;&quot;&quot;<br>
&gt;<br>
&gt; cmd = &#39; &#39;.join(sys.argv[1:])<br>
&gt;<br>
&gt; def start_subprocess():<br>
&gt;    return subprocess.Popen(cmd, shell=True)<br>
&gt;<br>
&gt; p = start_subprocess()<br>
&gt;<br>
&gt; while True:<br>
&gt;<br>
&gt;    res = p.poll()<br>
&gt;    if res is not None:<br>
&gt;        print p.pid, &#39;was killed, restarting it&#39;<br>
&gt;        p = start_subprocess()<br>
&gt;<br>
&gt;    time.sleep(1)<br>
&gt; _______________________________________________<br>
&gt; Baypiggies mailing list<br>
&gt; <a href="mailto:Baypiggies@python.org">Baypiggies@python.org</a><br>
&gt; To change your subscription options or unsubscribe:<br>
&gt; <a href="http://mail.python.org/mailman/listinfo/baypiggies" target="_blank">http://mail.python.org/mailman/listinfo/baypiggies</a><br>
&gt;<br>
<br>
</div></div>there&#39;s also the monitor option in paste serve. check out<br>
restart_with_monitor() in<br>
<a href="http://svn.pythonpaste.org/Paste/Script/trunk/paste/script/serve.py" target="_blank">http://svn.pythonpaste.org/Paste/Script/trunk/paste/script/serve.py</a><br>
which you could crib from or use directly.<br>
<div><div></div><div class="h5">_______________________________________________<br>
Baypiggies mailing list<br>
<a href="mailto:Baypiggies@python.org">Baypiggies@python.org</a><br>
To change your subscription options or unsubscribe:<br>
<a href="http://mail.python.org/mailman/listinfo/baypiggies" target="_blank">http://mail.python.org/mailman/listinfo/baypiggies</a></div></div></blockquote></div><br>