From owner-freebsd-questions@FreeBSD.ORG Thu Feb 7 13:49:50 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 1A52916A418 for ; Thu, 7 Feb 2008 13:49:50 +0000 (UTC) (envelope-from navneet.upadhyay@gmail.com) Received: from rn-out-0910.google.com (rn-out-0910.google.com [64.233.170.187]) by mx1.freebsd.org (Postfix) with ESMTP id A6CA813C45D for ; Thu, 7 Feb 2008 13:49:49 +0000 (UTC) (envelope-from navneet.upadhyay@gmail.com) Received: by rn-out-0910.google.com with SMTP id s42so1392821rnb.13 for ; Thu, 07 Feb 2008 05:49:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=2REFnI1C++yZrCajefyfyASXXUqxUL+w3EZB1doU0Aw=; b=KeS2oHRxJJ5JPSszUsvx7o4cDmZQ/oOw0OoSwAKkTKyY8FZHTulwe2q+TDwngq0PdkkUoQJQRyA/YYjnHBEbKMADz/3fjUHACtebSxn9GGlRf4V+cTpyGzuorhw0RBnHhOY+fl3JPhd9LcL9wP+UIy7xCs/QSGYjiNztmdyXZdg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=v28oEc8Y1Uvu8PwBqvmCx6Kl+eqO1alZB1Q50WmE+jGucj4Sm2YkQ/YZd9fXccrM/V97onYPpaF/RscBJCBCUXIkCcfgqYXhUL+ZGqYSJR8blHlqT+IXcITUBOYIGU3huUJvT0DrOEXdd44TfFu+OmLw2hviTdQ+vw6azixgePE= Received: by 10.150.139.15 with SMTP id m15mr4652558ybd.99.1202392188326; Thu, 07 Feb 2008 05:49:48 -0800 (PST) Received: by 10.150.185.7 with HTTP; Thu, 7 Feb 2008 05:49:48 -0800 (PST) Message-ID: <1563a4fd0802070549r71731883t9d606a2e62f67d4d@mail.gmail.com> Date: Thu, 7 Feb 2008 19:19:48 +0530 From: "navneet Upadhyay" To: freebsd-questions@freebsd.org In-Reply-To: <47A9FB98.4020907@bsdforen.de> MIME-Version: 1.0 References: <1563a4fd0802060609j59451879h3920be790d7667c0@mail.gmail.com> <47A9FB98.4020907@bsdforen.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 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: Thu, 07 Feb 2008 13:49:50 -0000 Hi, After putting my script to /etc/rc.d , it gets executed at startup and the parameter passed to the script is *faststart .* *I want the same script to be executed when system shuts down , how can i do that.* ** *i want to do something like this in script :- * ** *if [$1 = "faststart"]; then* *start my executables* *elif * *stop my executables* *fi* ** *question is :-* ** *How to excute a script when system comes up and shuts down with differnt parameter.* ** *Thanks,* *navneet* On 2/6/08, Dominic Fandrey wrote: > > 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. >