[Twisted-Python] new function for t.i.main

Moshe Zadka m at moshez.org
Tue Aug 7 04:56:00 EDT 2001


daemonize() is cool, useful and should really be refactored out
of twistd
I really see no harm in providing more functionality in t.i.main
Flamewars re: correct debian packaging will be left for later.

def daemonize():
    if os.fork():
        os._exit(0)
    os.setsid()
    os.close(0)
    os.close(1)
    os.close(2)
    if os.fork():
        os._exit(0)
    os.umask(0)

Here's a quick thought about Debian packaging:
add a script to ./bin "debianize".
This script will take a .tap file and create a package named the same
as the .tap file which relevant /etc/init.d/package and 
/var/lib/package/package.tap
Perhaps even add it as a generic argument to mktap, so
mktap --debian web --static /var/www
will create the debian package.
One caveat: version numbers.
-- 
Moshe Zadka - http://moshez.geek
(if you're not cool, http://moshez.org is still working)





More information about the Twisted-Python mailing list