From owner-freebsd-questions@FreeBSD.ORG Mon Mar 2 15:56:00 2009 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 5C33110656C3 for ; Mon, 2 Mar 2009 15:56:00 +0000 (UTC) (envelope-from jerrymc@gizmo.acns.msu.edu) Received: from gizmo.acns.msu.edu (gizmo.acns.msu.edu [35.8.1.43]) by mx1.freebsd.org (Postfix) with ESMTP id EE54B8FC1B for ; Mon, 2 Mar 2009 15:55:59 +0000 (UTC) (envelope-from jerrymc@gizmo.acns.msu.edu) Received: from gizmo.acns.msu.edu (localhost [127.0.0.1]) by gizmo.acns.msu.edu (8.13.6/8.13.6) with ESMTP id n22Fr307056203; Mon, 2 Mar 2009 10:53:03 -0500 (EST) (envelope-from jerrymc@gizmo.acns.msu.edu) Received: (from jerrymc@localhost) by gizmo.acns.msu.edu (8.13.6/8.13.6/Submit) id n22Fr3JI056202; Mon, 2 Mar 2009 10:53:03 -0500 (EST) (envelope-from jerrymc) Date: Mon, 2 Mar 2009 10:53:03 -0500 From: Jerry McAllister To: gahn Message-ID: <20090302155303.GA56093@gizmo.acns.msu.edu> References: <798008.8114.qm@web52107.mail.re2.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <798008.8114.qm@web52107.mail.re2.yahoo.com> User-Agent: Mutt/1.4.2.2i Cc: freebsd general questions Subject: Re: rc.conf and starting scripts 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: Mon, 02 Mar 2009 15:56:00 -0000 On Sun, Mar 01, 2009 at 07:14:17PM -0800, gahn wrote: > > Hi all: > > I have some starting scripts under some other directories other > than /etc/rc.d. How could I utilize the rc.conf file to start them > when the system boots up? > > The default location for rc.conf is /etc/rc.d only and the > knob "local_startup=/usr/local/etc/rc.d" doesn't seem to be working > for me for some reasons The way the question is put implies some possible misunderstanding about how rc.conf works. /etc/rc.conf itself is not executed. It is read up by the various scripts in etc/rc.d and /usr/local/etc/rc.d to get values for constants that are defined there. Some of those constants are things like linux_enable="YES" or lpd_enable="YES" or hostname="fred.cheeze.org" and many other possible things. the /etc/rc.conf files does nothing active. It just sets there like a bunch of passive data waiting to be looked at. The rc system goes through the rc.d directories and, according to its rules checks the script files in those directories and executes those scripts that merit execution in an order determined by its protocol. It used to be strictly alphabetical, but is more sophisticated now. See man rc and man rcorder. The scripts read up /etc/rc.conf and check for constants that interest them, such as one to enable or run something. If the file name ends in 'd', the convention is that it is a daemon. But other things could be run to check stuff or set up some files, or whatever. Besides telling a script to run or exit without doing anything, the constants also set conditions for things, such as that hostname setting. But, it is up to the scripts - most or all in one of the rc.d directories - to do anything about what is in /etc/rc.conf. Just putting something in the rc.conf file does nothing. One or more of the scripts are what looks for the stuff you put in rc.conf and does/do all the work. The scripts in the rc.d directories have to have execute permission. There is a protocol set up for them to determine at which point in the boot process they run (most can also be run manually after the system is up, though doing them out of order can produce unpleasant results in some cases). So, put your script in /usr/local/etc/rc.d. Include the appropriate protocol in the script (see man rc.d, man rc.conf and other related man pages) and make sure it reads /etc/rc.conf if it needs constants set or needs to decide whether or not to start something. ////jerry > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"