From owner-freebsd-questions@FreeBSD.ORG Wed Feb 6 18:56:32 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F277C16A420 for ; Wed, 6 Feb 2008 18:56:32 +0000 (UTC) (envelope-from fbsd06+S3=4afc8aa7@mlists.homeunix.com) Received: from mxout-03.mxes.net (mxout-03.mxes.net [216.86.168.178]) by mx1.freebsd.org (Postfix) with ESMTP id A946F13C4DD for ; Wed, 6 Feb 2008 18:56:32 +0000 (UTC) (envelope-from fbsd06+S3=4afc8aa7@mlists.homeunix.com) Received: from gumby.homeunix.com. (unknown [87.81.140.128]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTP id 00CF223E4B9 for ; Wed, 6 Feb 2008 13:56:27 -0500 (EST) Date: Wed, 6 Feb 2008 18:56:21 +0000 From: RW To: freebsd-questions@freebsd.org Message-ID: <20080206185621.08bbe275@gumby.homeunix.com.> In-Reply-To: <9bbcef730802060952o178e654hbc0412127c7e887a@mail.gmail.com> References: <1563a4fd0802060609j59451879h3920be790d7667c0@mail.gmail.com> <20080206163423.E4029@wojtek.tensor.gdynia.pl> <9bbcef730802060952o178e654hbc0412127c7e887a@mail.gmail.com> X-Mailer: Claws Mail 3.0.2 (GTK+ 2.12.7; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: script to be executed on system startup. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2008 18:56:33 -0000 On Wed, 6 Feb 2008 18:52:26 +0100 "Ivan Voras" wrote: > On 06/02/2008, Wojciech Puchar wrote: > > > (for example: "/etc/rc.d/myscript") > > > 2. chmod a+x the script > > > 3. you're done. > > > > > > This will work for the recent versions of FreeBSD (you didn't say > > > for which version do you need it). > > > > you need to make that script react for "start" and "stop" commands > > at least > > You *can*, but you don't *need* to, if in a hurry :) The script will > be executed once at startup, and it can parse the "start" argument > given to it, but it doesn't have to. In a proper RCNG script you don't parse stop/start, you override the stop/start functions. Parsing $1 directly is how the old-style scripts use to work, but the base system and most ports now use the RCNG framework. > Yes, it's somewhat dirty if you > ignore start/stop arguments (and if you ignore them you can't rely on > nice built-in features like "restart" internally executing stop, then > start) but it works. It depends, if the script is just starting a daemon then it can simply use the default start/stop handlers, and stop/start/restart works without any explicit handling.