From owner-freebsd-ports@FreeBSD.ORG Tue Jan 22 15:29:35 2013 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9AB659A4 for ; Tue, 22 Jan 2013 15:29:35 +0000 (UTC) (envelope-from magik@roorback.net) Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com [74.125.83.49]) by mx1.freebsd.org (Postfix) with ESMTP id 21063D99 for ; Tue, 22 Jan 2013 15:29:34 +0000 (UTC) Received: by mail-ee0-f49.google.com with SMTP id d4so3441239eek.22 for ; Tue, 22 Jan 2013 07:29:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=V5Df+v2WteSVkgY/AnIdH90M4r8EM+I2zf9FF7BODCc=; b=fkHh/5cLPdjsVZV7zWIfkhuuNEPUF7nLcQ5YJYdH6M7Aj5G4cJa7pRvKwZv/ChDGNu CwPXZIqgwhQoSjvwIYwafQxAm9nApd8aMl8eRaB3ZrllhtLN70a2kfLTM3OR0kJagwOZ 96UUsGcesYbeRo32gf6QjgDoFA3SwMMEHpKY6kk1PL+WPXl6fYwxDHTsxVof/N6eU+S/ lP4jFai/ihMd7ga07WLFCisg17otLlAs5MJANBuqheFdvXJMxtLSxd+MZTA9C6MXqP54 2ADEJ7TKxXVtw247SmJ87n+oFEF/Vnc2ZDt9Uo4kL1Y7IvzBE7fE+VApI16j4Z8xfjUh fTtA== X-Received: by 10.14.175.70 with SMTP id y46mr73342450eel.6.1358868567643; Tue, 22 Jan 2013 07:29:27 -0800 (PST) Received: from [10.1.1.66] (cerber2.pf.com.pl. [157.25.200.133]) by mx.google.com with ESMTPS id 43sm27392028eed.10.2013.01.22.07.29.26 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Jan 2013 07:29:26 -0800 (PST) Message-ID: <50FEB055.8080601@roorback.net> Date: Tue, 22 Jan 2013 16:29:25 +0100 From: Grzegorz Blach User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: freebsd-ports@freebsd.org Subject: Re: How to launch services that do not fork to background using the rc infrastructure? References: <50FEAE0D.5090505@diatel.upm.es> In-Reply-To: <50FEAE0D.5090505@diatel.upm.es> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Gm-Message-State: ALoCoQm75BSP3GuG7sFhtMTDVflPkFBEjWMOXD+Lj2lL3rL4uqNlqOxMUMHSajz9CTIBWIHjCDAv X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jan 2013 15:29:35 -0000 On 01/22/2013 04:19 PM, Javier Martín Rueda wrote: > The typical and simple rc.d script to launch a service has, esentially, > the following: > > . /etc/rc.subr > > name=SERVICE > rcvar=SERVICE_enable > > command="/usr/local/sbin/PROGRAM" > > pidfile=/var/run/${name}.pid > SERVICE_enable=${SERVICE_enable:-"NO"} > > load_rc_config ${name} > run_rc_command "$1" > > One of the ports (net/spread4) runs a PROGRAM that does not fork to > background as a daemon and which does not have any command-line option > to ask it to do so. Therefore, the rc.d script never finishes, with > various consequences (system boot stops, no pid file generated...) > > I tried adding a "&" to SERVICE_flags to see if it made it run in the > background, but it didn't do the trick. I also quickly checked the > /etc/rc.subr code to see if there is any way of forcing a background > launch, but couldn't see anything. No luck searching the web or problem > reports either. > > So, my question is whether there is a non-obvious way of forcing a > program to start in background using the rc infrastructure. > Try command="/usr/sbin/daemon -c -f -p $pidfile PROGRAM" or some thing like this.