From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS14383 205.234.109.0/24 X-Spam-Status: No, score=-0.7 required=5.0 tests=MSGID_FROM_MTA_HEADER, RP_MATCHES_RCVD shortcircuit=no autolearn=unavailable version=3.3.2 Path: news.gmane.org!not-for-mail From: =?iso-8859-1?q?I=F1aki_Baz_Castillo?= Newsgroups: gmane.comp.lang.ruby.unicorn.general Subject: Re: How to trap USR2 for custom ussage ? Date: Thu, 24 Dec 2009 10:40:25 +0100 Message-ID: <200912241040.25841.ibc@aliax.net> References: <200912231529.11880.ibc@aliax.net> <20091223204705.GD13735@dcvr.yhbt.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1261647673 10941 80.91.229.12 (24 Dec 2009 09:41:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 24 Dec 2009 09:41:13 +0000 (UTC) To: mongrel-unicorn@rubyforge.org Original-X-From: mongrel-unicorn-bounces@rubyforge.org Thu Dec 24 10:41:06 2009 Return-path: Envelope-to: gclrug-mongrel-unicorn@m.gmane.org X-Original-To: mongrel-unicorn@rubyforge.org Delivered-To: mongrel-unicorn@rubyforge.org User-Agent: KMail/1.12.2 (Linux/2.6.28-16-generic; KDE/4.3.2; x86_64; ; ) In-Reply-To: <20091223204705.GD13735@dcvr.yhbt.net> X-BeenThere: mongrel-unicorn@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: mongrel-unicorn-bounces@rubyforge.org Errors-To: mongrel-unicorn-bounces@rubyforge.org Xref: news.gmane.org gmane.comp.lang.ruby.unicorn.general:240 Archived-At: Received: from rubyforge.org ([205.234.109.19]) by lo.gmane.org with esmtp (Exim 4.50) id 1NNkBr-0007Ko-2t for gclrug-mongrel-unicorn@m.gmane.org; Thu, 24 Dec 2009 10:41:03 +0100 Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id AD5C319782D4; Thu, 24 Dec 2009 04:41:02 -0500 (EST) Received: from mail-fx0-f226.google.com (mail-fx0-f226.google.com [209.85.220.226]) by rubyforge.org (Postfix) with ESMTP id 8A11616782B6 for ; Thu, 24 Dec 2009 04:40:31 -0500 (EST) Received: by fxm26 with SMTP id 26so8050979fxm.19 for ; Thu, 24 Dec 2009 01:40:30 -0800 (PST) Received: by 10.223.5.18 with SMTP id 18mr1704291fat.58.1261647630278; Thu, 24 Dec 2009 01:40:30 -0800 (PST) Received: from ibc-laptop.localnet (16.85-84-188.dynamic.clientes.euskaltel.es [85.84.188.16]) by mx.google.com with ESMTPS id 14sm2859265fxm.11.2009.12.24.01.40.28 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 24 Dec 2009 01:40:28 -0800 (PST) El Mi=E9rcoles, 23 de Diciembre de 2009, Eric Wong escribi=F3: > First off I really don't think you need to be using DRb for this or > (generally) sticking things into the master process that don't belong > there. The problem is: how to start a server (which binds in a TCP port) in just o= ne = worker? humm, would the following make sense?: after_fork do |server, worker| # Start DRb server just in worker[0] if worker.nr =3D=3D 0 ... start DRb server ... end end But it would also fail upon receipt of USR2 as there would be two instances= of = the DRb server trying to bind on same port... > > Is there any way to achive this? > > I could imagine a new config option "on_usr2" (or "before_reexec") so t= he > > passsed block would be executed upon receipt of USR2 (before the real > > "reexec" method). > > > > Does it make sense? > = > There's already a similar before_exec hook documented in > http://unicorn.bogomips.org/Unicorn/Configurator.html > But it is called after forking, so the listener will be shared. Hummm, perhaps I could use the above code plus: before_exec do |server| .... stop DRb server ... end In this way the DRb server is stopped before exec and started in the new = worker[0]. Just a problem, how to access to existing/old worker[0] from "before_exec" = in = order to stop the DRb server? = > But again, you don't need to use DRb for this. As I've said in other thread I want DRb to get some info related to the = application. A DRb client console could be used to check application = database(s) connection and so. What would you suggest for this rather than DRb server? = Again thanks a lot for your help. -- = I=F1aki Baz Castillo _______________________________________________ Unicorn mailing list - mongrel-unicorn@rubyforge.org http://rubyforge.org/mailman/listinfo/mongrel-unicorn Do not quote signatures (like this one) or top post when replying