Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Jan 2013 16:19:41 +0100
From:      =?ISO-8859-1?Q?Javier_Mart=EDn_Rueda?= <jmrueda@diatel.upm.es>
To:        freebsd-ports@freebsd.org
Subject:   How to launch services that do not fork to background using the rc infrastructure?
Message-ID:  <50FEAE0D.5090505@diatel.upm.es>

next in thread | raw e-mail | index | archive | help
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.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?50FEAE0D.5090505>