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

  • Home
  • SEARCH
  • 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 8577071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:04:49+00:00 2026-06-11T20:04:49+00:00

I have two ruby server scripts, powerupserver.rb and outputserver.rb, of the form: require ‘/Library/WebServer/sample_app/config/environment’

  • 0

I have two ruby server scripts, powerupserver.rb and outputserver.rb, of the form:

require '/Library/WebServer/sample_app/config/environment'
# more requires

@server = TCPServer.open(port_number)                          
loop do                                                 
  Thread.start(@server.accept) do |sock| 
    # do stuff
  end
end

In development I use Foreman to run them and that works great. Now I am trying to run and monitor them in the background as daemons with Bluepill. I chose Bluepill mostly because Foreman has an option to export to a Bluepill config file (.pill file). So I did that and then altered the .pill file as needed to get the following:

Bluepill.application("sample_app", :foreground => false, :log_file => "/var/bluepill/log/bluepill.log") do |app|

  app.process("powerupserver") do |process|
    process.start_command = "ruby powerupserver.rb"
    process.working_dir = "/Library/WebServer/sample_app"
    process.pid_file = "/var/bluepill/pids/powerupserver-1.pid"
    process.daemonize = true
    process.stdout = process.stderr = "/var/bluepill/log/powerupserver-1.log"

    process.start_grace_time = 3.seconds
    process.stop_grace_time = 5.seconds
    process.restart_grace_time = 8.seconds
    process.stop_signals = [:quit, 30.seconds, :term, 5.seconds, :kill]

    process.checks :cpu_usage, :every => 10.seconds, :below => 5, :times => 3
    process.checks :mem_usage, :every => 10.seconds, :below => 100.megabytes, :times => [3,5]
    process.checks :flapping, :times => 2, :within => 30.seconds, :retry_in => 7.seconds

  end

  # more lines here mimicking above, but for server script 'outputserver.rb'
end

When I load this .pill, and check the status (sudo bluepill status), I see:

$ sudo bluepill status
powerupserver(pid:0): up
outputserver(pid:0): up

So it is supposedly up (albeit with pid’s of 0? which certainly doesn’t seem good), but I can see that they are not running/doing what they’re supposed to do. Could someone with Bluepill knowledge help me figure out what I’m doing wrong here? Thank you so so much in advance!

  • 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-11T20:04:50+00:00Added an answer on June 11, 2026 at 8:04 pm

    I ended up using the Daemons ruby gem to daemonize my scripts and using Bluepill to monitor them. I know you can do both using only Bluepill, but I couldn’t figure it out at the time and my system has been working just fine. I am using Rails 3.0.3, Daemons 1.1.5 and Bluepill 0.0.51. So first things first, make sure you have Daemons and Bluepill installed.

    So let’s say we have myserver.rb, a ruby server script living inside my rails app root. In order to daemonize it with Daemons, create myserver_control.rb within the root folder to tell Daemons how to daemonize:

    # myserver_control.rb
    require 'rubygems'
    require 'daemons'
    
    @options = {
        :dir_mode => :normal,
        :dir => '/Library/WebServer/myrailsapp/pids',
        :multiple => true,
        :backtrace => true,
        :monitor => false,
        :log_dir => '/Library/WebServer/myrailsapp/log',
        :log_output => true
    }
    
    Daemons.run('myserver.rb', @options)
    

    Check out the Daemon documentation to learn more about the options hash. You can now run your daemon from inside your rails app root folder at the command line using ‘sudo ruby myserver_control.rb start’. This is the daemon start up command that you can put in your Bluepill config file (myrailsapp.pill file) like so:

    Bluepill.application("myrailsapp", :foreground => false, :log_file => "/Library/WebServer/myrailsapp/log/bluepill.log") do |app|
    
      app.process("myserver") do |process|
    
        process.start_command = "sudo ruby myserver_control.rb start"
        process.stop_command = "sudo ruby myserver_control.rb stop"
        process.restart_command = "sudo ruby myserver_control.rb restart"
    
        process.pid_file = "/Library/WebServer/myrailsapp/pids/myserver.rb0.pid"
    
        process.working_dir = "/Library/WebServer/myrailsapp"
    
        process.start_grace_time = 5.seconds
        process.stop_grace_time = 5.seconds
        process.restart_grace_time = 8.seconds
    
      end
    end
    

    Definitely go read up on the Bluepill documentation to see all of your many options. Then when you start up Bluepill you have a monitored daemon. Make sure all of the folders referenced in the examples above exist (e.g. pids).

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

Sidebar

Related Questions

Im using the standard Ruby-on-Rails WEBBRICK server. Im testing and If I have two
I have two Ruby arrays, and I need to see if they have any
Possible Duplicate: Why do this Ruby object have two to_s and inspect methods that
In Ruby, I want to have two threads running at the same time, and
I have once again fleshed out Ruby, after two years of not touching it,
I have two files client.php and server.php. The client file send a HTTP request
I have a server which sends two messages to the client in a row:
I have two websites running on the same server. Both use passenger and rvm.
I have an apache2 server running Phusion Passenger. On this machine I have two
Have two folders with approx. 150 java property files. In a shell script, how

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.