473,326 Members | 2,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

How to write UNIX daemons in Python?

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.
Best regards

Sep 13 '06 #1
2 2408
gn****@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:

http://wiki.debian.org/DebianPythonFAQ

Diez
Sep 13 '06 #2
gn****@gmail.com schrieb:
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.
I would create packages, and therefore restrict attention to the
systems that are to be supported.

For RPM, there is a distutils bdist_rpm command which can help in
generating the RPM. OTOH, it might be actually easier to write a .spec
file and build the RPM "manually".

For .deb, there is also a bdist_deb distutils command (although not
part of the standard Python distribution), again, it is likely easier
to use the standard Debian packaging tool chain (i.e. with an
explicit debian/ subdirectory, initially populated with dh_make).

In either case, it is probably a good idea to look at source packages
to get started quickly.

FWIW, Debian does *not* put daemon programs in /usr/bin. Debian
follows the FHS, which specifies that system binaries go into
/usr/sbin. /usr/bin is limited to user programs.

Regards,
Martin
Sep 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: RosalieM | last post by:
I would like to understand what python needs to work on unix. And to understand how i can make it smalest possible? I dont understand at all setup. I searched in python.org and in sources but it...
2
by: Nigel King | last post by:
Hi, I have (my son has!) implemented protection against multiple instances causing havoc by creating a directory. This fails if it exists and thus in a single instruction one gets both the acquire...
2
by: timdoyle05 | last post by:
Hi, I have a question relating to how Unix commands can be issued from Python programs. Im am currently writing a large test script in python and I need this script to call three other separate...
18
by: Xah Lee | last post by:
i've started to read python tutorial recently. http://python.org/doc/2.3.4/tut/tut.html Here are some quick critique: quick example: If the input string is too long, they don't truncate it,...
4
by: Michael | last post by:
Hi, I'm having difficulty finding any previous discussion on this -- I keep finding people either having problems calling os.exec(lepev), or with using python's exec statement. Neither of...
3
by: Matthew Warren | last post by:
I have the following piece of code, taken from a bigger module, that even as I was writing I _knew_ there were better ways of doing it, using a parser or somesuch at least, but learning how wasn't...
8
by: dmoore | last post by:
Hi folks, I've seen the following issue come up in multiple posts to this mailing list: I have a python program that spawns a child process with popen or popen2 or popen3 or popen2.popen2...
0
by: Andrey | last post by:
HI i have a newbie question about the file() function. I have 2 daemons running on my linux box. 1 will record the IDs to a file - logs.txt other 1 will open this file, read the IDs, and then...
3
by: PurpleServerMonkey | last post by:
Seeking feedback from group members on a design I'm looking at using in a project. I've created an XML-RPC server and a number of Daemons, the idea is that the XML-RPC server gets a request from...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.