On 09:06 pm, p...@bubblehouse.org wrote: >On Jun 22, 2009, at 4:30 PM, Jared Gisin wrote: >>Which is iditic as my application may not even expose a 13pidfile or >>a 13logfile and it 19s definatley not called twistd. The platform >>specific application runners need to be more generalized so users >>can write their own twistd equivalent to include only what they want.
>Look at the init script used to start MySQL sometime, particularly >when installed from a package on a finicky distro like debian. Or >Apache. Or bind. Or any one of a number of other complex daemons -- >you'll find that it's not usually advisable (or possible) to launch >any of these daemons without an endless list of command-line options. Sure, but we should be able to do better than that, right? :) >You said yourself that you should be able to write a python script >that functions in a certain way, but what makes you think it should be >integrated into twistd? You could write a wrapper that made use of the >many other convenient scripting features Twisted provides (such as >twisted.python.usage.Options) and which would then in turn launch the >twistd process with the arguments you require, much like MySQL's >mysqld_safe bootstrap utility. Actually, it's even simpler than that. The script is itself a function, which you can just call as a function without starting a separate process. Axiom had requirements like Mr. Gisin: we wanted to put the .pid file and log files inside the database directory, which is a location that obviously has to be computed. I wouldn't object to a more graceful and structured way to do this, but the approach "axiomatic" uses is pretty simple: provide a twistd plugin that does the meat of the work, then have a small wrapper script that builds a command line that includes the plugin and the appropriate options, such as logfile and pidfile. You can see that code here: http://divmod.org/trac/browser/trunk/Axiom/axiom/scripts/axiomatic.py http://divmod.org/trac/browser/trunk/Axiom/twisted/plugins/axiom_plugins.py _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python