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 6858913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:13:08+00:00 2026-05-27T02:13:08+00:00

I have a plain ruby application (it’s not a Web app, so not using

  • 0

I have a plain ruby application (it’s not a Web app, so not using a pre-existing platform like rails, sinatra…) processing data continuously.

I plan to deploy it with Capistrano and simply start it with the ruby command. The problem is that I get data by batches, and it can take few minutes to process them.

When I deploy a new version I would like to introduce a soft restart, meaning that the app will be first notify about the new deploy: so it can finish the batch, and then say ‘I m ready for an update’ (the deployment script will wait for that message).

Is there any Gem for that? Maybe Capistrano includes that option?

  • 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-05-27T02:13:08+00:00Added an answer on May 27, 2026 at 2:13 am

    Allow the application to trap POSIX signals. Take a look at the Signal class.

    If you send a kill <signal type> to the process, any signal handlers will be invoked, regardless of what the process is currently doing. You can, for example, set some sort of flag that is checked at a sensible point in your logic (at the end of a run loop, for example), terminating the process if that flag is set. There are many signals you can respond to, but SIGHUP or one of the SIGUSR signals probably make sense for what you’re doing… you can respond to whatever signal you like in whatever way you like, but it makes sense to allow the default behaviour for most of the typically handled ones (like SIGTERM and SIGKILL). For really complex stuff, you can actually accept a coded series of signals to trigger particular events too.

    Signal.trap("HUP") do
      puts "Huh?"
    end
    
    loop do
      puts "Looping..."
      sleep 2
    end
    

    Output

    [chris@chipbook:~%] ruby sig_demo.rb 
    Looping...
    Looping...
    Looping...
    Looping...
    Looping...
    Huh?
    Looping...
    Looping...
    Looping...
    Huh?
    Looping...
    Looping...
    Looping...
    

    Because in another terminal window I’d done:

    [chris@chipbook:/usr/local%] ps aux | grep ruby
    chris          69487   0.0  0.0  2425480    188 s005  R+   11:26pm   0:00.00 grep ruby
    chris          69462   0.0  0.1  2440224   4060 s004  S+   11:26pm   0:00.03 ruby sig_demo.rb
    [chris@chipbook:/usr/local%] kill -HUP 69462
    [chris@chipbook:/usr/local%] kill -HUP 69462
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am in the process of prototyping a web application using ruby on rails.
I have a simple form with some plain html input like bellow using ASP.NET
I have a jruby/rails app using: jruby 1.4.0 Rails 2.3.5 ActiveMQ 5.3.0 Mule ESB
Some of the users of our Ruby on Rails app have complained that page
Does Ruby have a plain-English keyword for exclusive or, like they have and and
I want to use Resque in a Ruby on Rails application. I have no
I'm attempting to use Mongoid from a plain Ruby script (not via Rails or
I have a plain text file looking like this: some text containing line breaks
I have a plain html web page with an embedded flash object. Based on
In an iPhone application, I have some plain C functions. Is it possible to

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.