A python program as a Win "Service" or Unix "Daemon"?
Johannes Nix
Johannes.Nix at mail.uni-oldenburg.de
Thu Mar 16 13:56:13 EST 2000
Alessandro Bottoni <Alessandro.Bottoni at think3.com> writes:
> Is there any way to install a Python program as a Unix Daemon or a Windows
> Service? (Together with an instance of the interpreter, of course..)
Speaking for Unix, a daemon program is not very special.
It has normally the following features:
- It runs in the background, without attached terminal (standard
input). That is in C usually achieved by closing the standard input
and doing a fork() (or vice versa?). This is almost equivalent to
creating a new thread, so the threads interface should be enough.
- It sometimes reacts specially to interrupts, for example it may
read-read its configuration file if it receives a SIGHUP
- It uses frequently protected services and ports and thus runs with
root or other special privileges.
- An advanced daemon may send log messages to the syslog daemon, which
will write it to a file as /var/log/messages, or send it to another
computer.
- It starts normally automatically by a call from the system startup
scripts.
As can be seen, this should be achieved easily with standard commands,
except perhaps the interrupt protection.
Johannes
More information about the Python-list
mailing list