Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7819031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:46:27+00:00 2026-06-02T06:46:27+00:00

I’m building an EC2 server using fabric, and want to launch a Twisted server

  • 0

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 sudo(...), to creating an init.d script.

The command works out to something like this:

/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

When using fabric, whether calling the line above directly through sudo(...) or using sudo to launch the init.d script, the process won’t actually launch successfully. If I log in to the box and launch it directly, the process stays launched.

I’ve gotten it to work through fabric, but I have to launch the init.d script 3 times before it sticks. Logging with --spew shows no exception. If I don’t run it 3 times, even the .pid file never gets created.

I’m lost as to where to start figuring out why this is happening, and the 3x hack works 100% consistently. Any ideas? Thanks!

EDIT

The output of /var/log/apnslistener.log is the following. Notice how the server is only successfully started the 3rd time.

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 <twisted.web.server.Site instance at 0x1c6dc20>
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__
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T06:46:30+00:00Added an answer on June 2, 2026 at 6:46 am

    Here’s a section in the docs for your use case. It’s related not to the sudo, but to the pty settings of default calls. More info in the FAQ.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.