Roll your own dispatch reaper script

If you haven’t used it before, the reaper script is useful for restarting your Rails application’s FastCGI dispatchers.

It’s seems the reaper script in Edge rails now relies on the existance of PID files in the tmp/pids directory. If you want to replicate the old functionality, create your own ruby script and override the capistrano restart task to call your own script instead of the standard script/reaper.

The reaper script for one of my apps is simply:

 #!/usr/bin/env ruby for process in `ps axwwl`.grep(/dispatch.fcgi/).collect { |s| s.split[1] }   puts "Sending USR2 to dispatch.fcgi process #{process}"   Process.kill("USR2", process.to_i) end 

The above code is in script/my_reaper and is called from the Capistrano deployment recipe as below:

 task :restart, :roles => :app do  run "ruby #{deploy_to}/current/script/process/my_reaper" end 


Category: programming Time: 2006-09-18 Views: 0

Related post

  • Roll Your Own Framework With Backbone.js 2011-10-05

    Let's make a collective decision here. We'll stop treating A-grade mobile phones as aliens, and see them for what they are: powerful, capable devices, running powerful rendering engines. Throwing a framework at your app, such as jQuery Mobile, Sencha

  • Roll Your Own Copy to Clipboard Feature in 20 Lines of JavaScript 2015-11-16

    Using the OS clipboard is a basic IT skill. As a developer, you've learned that tab, Ctrl/Cmd+A, Ctrl/Cmd+C followed by Ctrl/Cmd+V will highlight, copy and paste in an instant. Life is less easy for regular users. Even if a user knows what the clipbo

  • Google, Amazon, PayPal, roll your own, Shopping Cart/Checkout option that doesn't put off potential customers? 2010-07-09

    Google, Amazon, PayPal, roll your own. We have a custom coded online store with custom shopping carts that is using Amazon for the checkout process. When the customer 'checks out' of our site, they are sent to Amazon where the items are added to an A

  • When to roll your own game engine? 2011-05-19

    I've been a software developer for 5 years now and wanting to get into iOS game development. I've played around with the iOS SDK for about 2 years now, attending cocoaheads meetings and feel I have a good grasp on objective-c/cocoa and even c/c++. I

  • Using a microframework, or rolling your own 2011-08-06

    I really like a microframework in Python called Flask. I have used it for the past 2 months, and I find it excellent. Now, I would like to use it in deployment, but, there are a few things I'm afraid of. Firstly, even though its a microframework, it

  • BuildMobile: Roll Your Own Framework With Backbone.js 2011-10-06

    Let's make a collective decision here. We'll stop treating A-grade mobile phones as aliens, and see them for what they are: powerful, capable devices, running powerful rendering engines. Throwing a framework at your app, such as jQuery Mobile, Sencha

  • How to roll your own authentication for an external Salesforce App? 2013-11-04

    Background If you're building an app, that involves Doing some very basic actions on behalf of non-Salesforce users, i.e. creating a Quote Is hosted externally (in other words, not APEX, but rather PHP, or Node.JS Heroku app) Requires some basic auth

  • Is rolling your own network protocol insecure? 2015-10-01

    By now, everyone on here should know that rolling your own crypto is bad. But what's about rolling your own (encryption supporting) network protocol? I'm working on an open-source project (by now it's an idea to be honest) where I need to exchange a

  • Roll your own encryption - with a twist 2016-06-15

    I am familiar with Schneier's Law: Any person can invent a security system so clever that he or she can't imagine a way of breaking it. I have read the many posts on this exchange littered with questions about how to write your own security algorithm

  • managing vm backups - roll your own or buy the tools? 2009-07-15

    We're a small shop operating over a dozen vmware instances across 3 host machines. As we've added more VMs to our deployment for our clients, the piecemeal way we've done backups of our vm's has been showing its cracks. This especially became clear a

  • Roll-your-own mysql-server (.deb) files and MySQL root password 2010-12-06

    I know I can make my own .deb files of an installation. However, during a normal mysql-server install, the root password gets asked for and we need to do a 1-click rollout without ANY interaction. It needs to install AND set the root password. Can I

  • How to roll-your-own live CD for safe home browsing 2010-03-02

    I'm interested in booting-off-flash (i.e. like livecd) for more secure online banking at home. I like System Rescue CD, but AFAIK it doesn't have the wifi drivers. (These are convenient) Ubuntu LiveCD has the wi-fi drivers, but also has a lot of stuf

  • How to Roll Your Own JavaScript Compressor with PHP and the Closure Compiler 2010-08-31

    In my previous post, I discussed the Closure Compiler's REST API. In this article, we'll develop a small PHP program that shows how the API can be used to compress JavaScript code whenever you need it. Why write your own system? You'll find that seve

  • Roll your own web crawler to crawl one specific website that has multiple entries 2011-08-02

    What sort of languages would be able to handle writing your own web crawler? Could PHP handle this? I'm quite good with PHP (following best practices etc). But I'd like a good reason to learn a new language if I need to. The idea is to crawl one spec

  • Rolling your own WordPress Themes 2011-12-01

    I am looking to build my own WordPress theme to house my artwork. Can someone point me to the best tutorials for doing so and also give me some pointers on the best approach to building an image gallary? For example Should I build a custom gallery? I

  • At what point is a cryptosystem "rolling your own"? 2013-10-20

    This question already has an answer here: At what level of abstraction should a developer work with with regards to cryptography? 7 answers Everybody knows making your own cipher really sucks. Everybody also knows using existing cryptosystems, such a

  • Roll Your Own Twitter Clone 2009-04-14

    Everyone's talking Twitter, right? And there's Plurk, Jaiku, and Identica-in fact, there's dozens of new microblogging services popping up every week. If you're anything like me, you've already wondered how easy it would be to make your own-perhaps y

  • Rolling your own init: How to shutdown/restart? 2013-07-15

    After reading this answer, I thought it would be funny to roll my own init on Python, so I wrote this in /init-python. #!/usr/bin/python3 import os import subprocess # Make / writable!['/bin/mount', '-o', 'rw,remount', '/']) # Became

  • Roll-your-own GMail alternative 2013-06-10

    I'm quitting GMail but attempting to avoid the headaches that come with administering my own Internet-facing IMAP server. I have access to a commercial IMAP account, and I'd like to continue to use that account. Basically the way I'd like it to work

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 0.976 (s). 13 q(s)