Problem with asyncore and Python2.0

Michael Ströder michael at stroeder.com
Tue Apr 17 05:55:36 EDT 2001


Craig Findlay wrote:
> 
>    If I start the server from the console or from a remote SSH
> session, while I am logged on the server runs fine and clients can
> connect to it successfully.
>    However, If I then log off the console or the SSH session, the next
> time a client tries to connect, the process dies silently.

How about using command "nohup" to detach the process from the
console? (Might need redirecting of stdout and stderr on startup
command-line).

You can also add a fork call to your script to detach from the
console at startup automatically.

Here's what I'm doing:

if (os.name == 'posix') and run_detached:
  if os.fork():
    sys.exit(0)
  else:
    os.setsid()
    RunServer(...)

You might wanna change current directory to /, close sys.stdin and
redirect  sys.stdout and sys.stderr to some meaningful in your
situation.

Ciao, Michael.



More information about the Python-list mailing list