[Twisted-Python] twistd and init.d

gary clark burslem2001 at yahoo.com
Wed Apr 21 08:27:29 EDT 2010


I have written an init.d script thats starts and stops a twistd. You need to create a .tac file and create a daemon. A wee bit more tricky but you can start twistd fine.

Thanks,
Garyc

--- On Wed, 4/21/10, Tim Allen <screwtape at froup.com> wrote:

> From: Tim Allen <screwtape at froup.com>
> Subject: Re: [Twisted-Python] twistd and init.d
> To: "Twisted general discussion" <twisted-python at twistedmatrix.com>
> Date: Wednesday, April 21, 2010, 7:16 AM
> On Wed, Apr 21, 2010 at 01:38:09PM
> +0200, Don Schoeman wrote:
> >    This works fine when running
> /etc/init.d/ghserver start and
> >    /etc/init.d/ghserver stop. The script
> also run when I boot since the
> >    logger actually logs the "GHServer:
> Starting" text to the
> >    /var/log/messages file. However, my
> service actually does not start. There
> >    is no pid to be found anywhere, there are
> no error logs anywhere, just
> >    nothing. I might be doing something wrong
> here but is there someone who's
> >    gone through this process and can provide
> some samples how they did it?
> 
> I haven't written an init-script for twistd myself, I just
> use the one
> auto-generated by tap2rpm. You can compare your script to
> the template
> tap2rpm uses and see if that gives you any clues:
> 
>     http://twistedmatrix.com/trac/browser/trunk/twisted/scripts/tap2rpm.py#L17 
>   
> It surprises me that you say you can tell that the script
> runs at boot
> because you can see it in /var/log/messages - although most
> Linux
> distros hide the boot-script messages by default, they
> usually provide
> a way to display them for debugging purposes such as these
> (different
> distributions use different actions to trigger boot
> messages; if you
> can't find instructions for your distribution online, you
> might try
> hitting Escape a few times at different parts of the boot
> sequence).
> 
> Finally, in my limited experience of diagnosing scripts
> that work from
> an interactive shell but not at boot time, you might want
> to look for
> code that uses environment variables. $EMPLOYER once had
> some scripts
> that got some particular setting from an environment
> variable that was
> only set by interactive shells - so if you ssh'd to the
> machine and ran
> the code, it'd be fine, but it crashed when run at bootup.
> 
> CentOS (and perhaps other Linux distributions) has a tool
> called
> /sbin/service. If you run "/sbin/service ghserver start"
> rather than
> "/etc/init.d/ghserver start", /sbin/service will start the
> service in
> a clean, boot-like environment and you might get more
> debugging clues
> that way.
> 
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 




More information about the Twisted-Python mailing list