From owner-freebsd-ports Fri Dec 21 4:23:28 2001 Delivered-To: freebsd-ports@freebsd.org Received: from alcatraz.iptelecom.net.ua (alcatraz.iptelecom.net.ua [212.9.224.15]) by hub.freebsd.org (Postfix) with ESMTP id EDFAD37B419; Fri, 21 Dec 2001 04:23:19 -0800 (PST) Received: from ipcard.iptcom.net (ipcard.iptcom.net [212.9.224.5]) by alcatraz.iptelecom.net.ua (8.9.3/8.9.3) with ESMTP id OAA47856; Fri, 21 Dec 2001 14:23:14 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Received: from vega.vega.com (h55.228.dialup.iptcom.net [212.9.228.55]) by ipcard.iptcom.net (8.9.3/8.9.3) with ESMTP id OAA08888; Fri, 21 Dec 2001 14:23:13 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Received: from FreeBSD.org (big_brother.vega.com [192.168.1.1]) by vega.vega.com (8.11.6/8.11.3) with ESMTP id fBLCM1F09056; Fri, 21 Dec 2001 14:22:01 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Message-ID: <3C23295E.37E26CAD@FreeBSD.org> Date: Fri, 21 Dec 2001 14:21:50 +0200 From: Maxim Sobolev Organization: Vega International Capital X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) X-Accept-Language: en,uk,ru MIME-Version: 1.0 To: Ernst de Haan Cc: ports@FreeBSD.org Subject: Re: Starting a service after installation? References: <200112211144.fBLBif252175@zaphod.euronet.nl> Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Ernst de Haan wrote: > > Hey all, > > How should services like an application server (i.e. www/orion or > www/jakarta-tomcat) be started at boot time? > > I was thinking we could something like this, for example for www/orion: > 1) During installation, install a script in ${PREFIX}/etc/rc.d. In this case > orion.sh. Make it +x so it can be executed. The www/orion port (and a lot of > other ports) already do this. > 2) Make the script so that it checks if it should be started by reading > /etc/rc.conf and /etc/defaults/rc.conf. For example, for www/orion, it could > check for "start_orion". If this variable is not found, then the service is > perhaps not started (or should it) ? If the variable *is* found then the > service will only be started if the value matches [Yy][Ee][Ss] > > I'm also assuming that starting a service right after installation is a Bad > Thing^TM. What about a 'make run' ? ;`/ Usually FreeBSD ports use different strategy. The service installs startup script into /usr/local/etc/rc.d, in the case when the service is expected to be "on" right after installation this script is named fooservice.sh, but when the service is to be disable by default - the script is named fooservice.sh.sample. The script should take either "start" or "stop" argument - the former automatically supplied by /etc/rc.* during a machine startup, while the latter - during a shutdown. You can find plenty of examples in the ports tree usable as a template for such script. And I don't really think that you need something like `make run' because it's not much easier than direct call to appropriate script. Instead you could tweak the port to emit during post-install a message saying that the user should run `${PREFIX}/etc/rc.d/fooservice start' if he want to start the service right now. -Maxim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message