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

Moshe Zadka m at moshez.org
Wed Aug 8 04:03:11 EDT 2001

On Tue, 7 Aug 2001, Glyph Lefkowitz <glyph at twistedmatrix.com> wrote:

> Daemonize's functionality is probably useful, however, there are a few
> things it doesn't take into account.  Insofar as it's useful, most of
> twistd should probably be incorporated into it; any less is offering
> incomplete functionality.

No it isn't. It's offering *just* the daemonize functionality. You
can have a higher-level wrapper *on top* of that which is portable,
but daemonize() is useful.

> After all, this is about as platform specific as you get.

Yes it is. I firmly believe in platform-specific APIs which are then
wrapped in platform independent APIs. I don't want anything to restrict
my access to the OS

> If we have
> daemonize, then we probably want to have a similiar function for starting
> a Windows Service.

Yes, it would. This isn't an argument against daemonize.

> Moreover, it would be good if we could detect which
> platform we're on, then do the appropriate thing for creating a daemon on
> that platform.

But not with daemonize() -- with startService(....) which would call
daemonize() on UNIX.

> This implies logging.  "daemonize" won't work if you're still writing to
> standard output after you call it.

Well, it closes FD 1, so it works well enough for that.
Logging is left for a higher level API. As is writing PID files (which
must be done after daemonizing but before getting into the main loop)

> So I'd say daemonize should at least take a logfile, and a function +
> varargs, and never return.

No, that's startService, another useful API. 

> This sounds cool, with one minor caveat.
> I don't want to give windows users the impression that they're totally
> unsupported, especially any more than they already are.

Fine, support them ;-)

> We should make plans to have similiar windows-ize scripts, and even if we
> don't have them, make it clear that we're not trying to make a
> debian-specific server infrastructure.

*I* don't care if my server infrastructure is Debian specific.

> Also, wouldn't this "debian" functionality be very similiar for redhat,
> mandrake, etc?  Even solaris and MacOS X?  "unixize" might be a better
> name for it.

No. Debian uses .deb packages. Maybe whoever does RPM chooses to redhatize
or rpmize (I'm not sure: would she support SuSE? Mandrake?) Solaris
uses its own unique wonderful format, as does MacOS X and AIX.
I would be happy to put my /etc/init.d/ templates where everyone can use
them. Everything else is distribution specific. It's not hard to have
a hand install of a .tap if you have the /etc/init.d template.

I want the Debian packages to be good enough that I'll feel good enough
about uploading them to the official Debian archive, as well as maintainig
a huge apt source on tm.com. 
Moshe Zadka - http://moshez.geek
(if you're not cool, http://moshez.org is still working)

More information about the Twisted-Python mailing list