Hi Andrew,

Maybe this will help better explain what I am doing here.

Once  I have pinged a web service server and know it is down.

I will make this call ------



ssh [email protected] nohup python /ws/server.py & exit




This calls and boots up the Python script okay.

As you can see right now I like to keep things simple and lean.


I've never used the nohup call before.

But it sounded like it should do the trick.


As I mentioned it runs for a good long while but then dies again for no apparent reason.

When I remote in via a screen share to boot the Python script it runs just fine.



This a test and is using Python's simple HHTP server for now.

so I know no running code within the script is causing it to crash.


It appears to just decide to shut down after a few hours while sitting idle.


I was hoping maybe some one on the list might have another way to SSH in to re / boot a Python Script idea?


-Kevin



On May 03, 2011, at 8:11 PM, Andrew Beyer wrote:

On Tue, May 3, 2011 at 7:13 PM, Kevin LaTona <[email protected]> wrote:

I think it might have something to do with the SSH call that is creating a headless / background process.


I'm not sure what you mean by that...ssh isn't responsible for creating a long-lived process. Standard unix procedure is to have your process either get launched from inetd (or some similar service controller), or daemonize yourself. Are you actually detaching from your parents and the controlling terminal, or just running as a background process (bash '&')? The latter isn't sufficient to outlive the controlling (psuedo)terminal.

Check out: http://code.activestate.com/recipes/278731-creating-a-daemon-the-python-way/ for the code necessary to do the whole detaching jig according to the rules. (many of which may be optional or unnecessary in some cases, but should be followed for portability and consistency.)

Reply via email to