From owner-freebsd-questions@FreeBSD.ORG Wed Feb 6 18:50:37 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 4DC8B16A41B for ; Wed, 6 Feb 2008 18:50:37 +0000 (UTC) (envelope-from kamikaze@bsdforen.de) Received: from mail.bsdforen.de (bsdforen.de [212.204.60.79]) by mx1.freebsd.org (Postfix) with ESMTP id E4AE713C442 for ; Wed, 6 Feb 2008 18:50:36 +0000 (UTC) (envelope-from kamikaze@bsdforen.de) Received: from mobileKamikaze.norad (nat-wh-1.rz.uni-karlsruhe.de [129.13.72.169]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.bsdforen.de (Postfix) with ESMTP id 507D3405D1A; Wed, 6 Feb 2008 19:25:29 +0100 (CET) Message-ID: <47A9FB98.4020907@bsdforen.de> Date: Wed, 06 Feb 2008 19:25:28 +0100 From: Dominic Fandrey User-Agent: Thunderbird 2.0.0.9 (X11/20080205) MIME-Version: 1.0 To: navneet Upadhyay References: <1563a4fd0802060609j59451879h3920be790d7667c0@mail.gmail.com> In-Reply-To: <1563a4fd0802060609j59451879h3920be790d7667c0@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org 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:50:37 -0000 navneet Upadhyay wrote: > Hi, > I have a script file, i want that script to be executed on system > startup. > > I am doing this on Linux in following two steps : - > > 1. Copying the script to /etc/rc.d directory. > 2. /sbin/chkconfig --add "scriptname" > > > I want to achieve the same on FreeBSD > > chckconfig file is not present, documentation says i have to add it to > rc.conf file. > > How can i add it to rc.conf file, is there any command? There have been a lot of suggestions here and the thread contains all the valid information, but some people have given you deprecated advice. So I'll try to clarify what can be done and how it's meant to be done. 1. Your own scripts belong int /usr/local/etc/rc.d, if you update your system it will suggest to delete all custom scripts from /etc/rc.d, because it's only for scripts from the base system. Remember that path will not be set when your script is called at startup. The usual approach is to only use fully qualified filenames. 2. All executable scripts in /usr/local/etc/rc.d are executed at startup and given the parameter start. Upon shutdown the parameter stop is given. The name of the script does not matter. 3. To this point you have all the functionality you asked for and there is no need for you to look further. However you are at liberty to instead build a compliant rc.d script, which brings you the advantages of controlling the execute order by defining dependencies and being able to activate/deactivate scripts and additional parameters in the file /etc/rc.conf. If you wish to exploit these advanced features it's a good way to look at existing scripts in /usr/local/etc/rc.d and read the rc(8) manual page.