From owner-freebsd-ports@FreeBSD.ORG Tue Jan 22 15:19:52 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 B1435484 for ; Tue, 22 Jan 2013 15:19:52 +0000 (UTC) (envelope-from jmrueda@diatel.upm.es) Received: from smtp.upm.es (edison.ccupm.upm.es [138.100.198.71]) by mx1.freebsd.org (Postfix) with ESMTP id 159ECCEC for ; Tue, 22 Jan 2013 15:19:50 +0000 (UTC) Received: from smtp.euitt.upm.es (mail.euitt.upm.es [138.100.52.110]) by smtp.upm.es (8.14.3/8.14.3/edison-001) with ESMTP id r0MFJf1A015262 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Tue, 22 Jan 2013 16:19:41 +0100 Received: from localhost (localhost [127.0.0.1]) by smtp.euitt.upm.es (Postfix) with ESMTP id 816EC5693B for ; Tue, 22 Jan 2013 16:19:41 +0100 (CET) Received: from smtp.euitt.upm.es ([138.100.52.110]) by localhost (smtp.euitt.upm.es [127.0.0.1]) (amavisd-new, port 11124) with ESMTP id Ke3HW-L-E9rX for ; Tue, 22 Jan 2013 16:19:41 +0100 (CET) Received: from aurora.diatel.upm.es (aurora.diatel.upm.es [138.100.49.70]) (Authenticated sender: jmrueda) by smtp.euitt.upm.es (Postfix) with ESMTPSA id 13C3A56748 for ; Tue, 22 Jan 2013 16:19:41 +0100 (CET) Received: from [172.29.9.10] ([172.29.9.10]) by aurora.diatel.upm.es (8.14.5/8.14.5) with ESMTP id r0MFJeEc046105 for ; Tue, 22 Jan 2013 16:19:40 +0100 (CET) (envelope-from jmrueda@diatel.upm.es) Message-ID: <50FEAE0D.5090505@diatel.upm.es> Date: Tue, 22 Jan 2013 16:19:41 +0100 From: =?ISO-8859-1?Q?Javier_Mart=EDn_Rueda?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: freebsd-ports@freebsd.org Subject: How to launch services that do not fork to background using the rc infrastructure? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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:19:52 -0000 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.