[Python-au] running a socket server as deamon

James Alford mydnite1 at gmail.com
Fri Feb 12 06:01:16 UTC 2010


Hi All

Just need some advice on the best approach to running a socket server
that I have.  The socket server sits on a vps at a host, vps is
running centos5.2.  I need to ensure that this socket server is always
running.  I'm still investigating whether the vps does kill the the
server process in its clean up.

The couple of ideas I have are:
* Running the socket server as a deamon.
* Create a monitor process that checks to see if the pid of the socket
server exists, then if it can connect to the socket port, calls a
restart on the daemon and exits.
* Run the monitor process from a cron job.

Currently if the socket server can not bind on a port, it exits.

The daemon that I was going to use is the pypi link below.  The
jejik.com article code looks attractive for something where the
monitor code is built into the daemon code.

Daemon references:
http://pypi.python.org/pypi/python-daemon
http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/

Any thoughts?

Thanks.

James



More information about the python-au mailing list