Note that there are some explanatory texts on larger screens.

plurals
  1. POEC2 build with Fabric requires starting Twisted server at least 3x
    primarykey
    data
    text
    <p>I'm building an EC2 server using fabric, and want to launch a Twisted server for pyapns. I've tried several different ways of launching the script - simply calling <code>sudo(...)</code>, to creating an <code>init.d</code> script.</p> <p>The command works out to something like this:</p> <pre><code>/usr/local/bin/twistd -r epoll -u www-data -g www-data -l /var/log/apnslistener.log --pidfile=/var/run/apnslistener.pid web --class=pyapns.server.APNSServer --port=7077 -l /var/log/pyapns.log </code></pre> <p>When using fabric, whether calling the line above directly through <code>sudo(...)</code> or using <code>sudo</code> to launch the <code>init.d</code> script, the process won't actually launch successfully. If I log in to the box and launch it directly, the process stays launched.</p> <p>I've gotten it to work through fabric, but I have to launch the init.d script <em>3 times</em> before it sticks. Logging with <code>--spew</code> shows no exception. If I don't run it 3 times, even the .pid file never gets created.</p> <p>I'm lost as to where to start figuring out why this is happening, and the 3x hack works 100% consistently. Any ideas? Thanks!</p> <p><strong>EDIT</strong></p> <p>The output of <code>/var/log/apnslistener.log</code> is the following. Notice how the server is only successfully started the 3rd time.</p> <pre><code>2012-04-16 01:52:08+0000 [-] Log opened. 2012-04-16 01:52:08+0000 [-] twistd 12.0.0 (/usr/bin/python 2.7.2) starting up. 2012-04-16 01:52:08+0000 [-] reactor class: twisted.internet.epollreactor.EPollReactor. 2012-04-16 01:52:09+0000 [-] Log opened. 2012-04-16 01:52:09+0000 [-] twistd 12.0.0 (/usr/bin/python 2.7.2) starting up. 2012-04-16 01:52:09+0000 [-] reactor class: twisted.internet.epollreactor.EPollReactor. 2012-04-16 01:52:10+0000 [-] Log opened. 2012-04-16 01:52:10+0000 [-] twistd 12.0.0 (/usr/bin/python 2.7.2) starting up. 2012-04-16 01:52:10+0000 [-] reactor class: twisted.internet.epollreactor.EPollReactor. 2012-04-16 01:52:10+0000 [-] Site starting on 7077 2012-04-16 01:52:10+0000 [-] Starting factory &lt;twisted.web.server.Site instance at 0x1c6dc20&gt; 2012-04-16 01:52:10+0000 [-] set uid/gid 33/33 2012-04-16 01:52:12+0000 [HTTPChannel,0,127.0.0.1] APNSService __init__ </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload