How to write UNIX daemons in Python?
Diez B. Roggisch
deets at nospam.web.de
Wed Sep 13 12:05:04 CEST 2006
gnewsg at gmail.com wrote:
> Hi all. I've just finished to write an FTP daemon in Python.
> To do things well I'd like to write an 'insteller' to permit the end
> user to 'deeply' install the package inside the system. In details I
> would like that installer is able to do the following operations:
> - copy ftpd.py in /usr/bin.
> - depending on the system, it should be able to determinate where
> service startup directory is located (for example /etc/init.d) and
> copy a script able to automatically run /usr/ftpd.py at startup.
> - optionally install a manual callable with "man ftpd".
> - many other operations about the installation of a package.
> What should I use to do something like that? Do I have to use
> distutils? Do I have to use third party packages? Do I have to write a
> "setup.py" and solve the problem manually?
> This last solution is problematic becouse, for (dumb) example, Debian
> wants executable/programs to be located in /usr/bin while Fedora uses
> another path (for example /usr/sbin).
> Another question: what about .deb, .rpm, [...] packages?
> Does it possible to use them with Python programs?
> Resolving third party dependancies by using them could be a nice thing.
You can use setuptools to generate scripts in the various bin-directories.
And of course you could try and make setup.py detect the system & adapt the
necessary paths accordingly.
But the best thing to do would certainly be a package - however, I'm not
aware that there is any support for that. But a look here might be a start:
More information about the Python-list