From owner-freebsd-questions@FreeBSD.ORG Mon Feb 27 03:04:41 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2AF4116A420 for ; Mon, 27 Feb 2006 03:04:41 +0000 (GMT) (envelope-from jerrymc@clunix.cl.msu.edu) Received: from clunix.cl.msu.edu (clunix.cl.msu.edu [35.9.2.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1C94A43D48 for ; Mon, 27 Feb 2006 03:04:39 +0000 (GMT) (envelope-from jerrymc@clunix.cl.msu.edu) Received: from clunix.cl.msu.edu (localhost [127.0.0.1]) by clunix.cl.msu.edu (8.12.10+Sun/8.12.2) with ESMTP id k1R34ciU019442; Sun, 26 Feb 2006 22:04:38 -0500 (EST) Received: (from jerrymc@localhost) by clunix.cl.msu.edu (8.12.10+Sun/8.12.2/Submit) id k1R34bf3019441; Sun, 26 Feb 2006 22:04:37 -0500 (EST) From: Jerry McAllister Message-Id: <200602270304.k1R34bf3019441@clunix.cl.msu.edu> To: listor@melin.org (Joacim Melin) Date: Sun, 26 Feb 2006 22:04:37 -0500 (EST) In-Reply-To: X-Mailer: ELM [version 2.5 PL7] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: Startup script 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, 27 Feb 2006 03:04:41 -0000 > > Hi all, > > newbie question: which script do I put stuff that needs to be booted > during system startup, like apache httpd, spamd, named, etc? First of all, you should put a separate script for each utility to start in the /usr/local/etc/rc.d/ directory. Many of these utilities do that for you automatically when you install them through the ports system. The script should be written to accept at least start|stop as arguments. When the system boots, it attempts to run every script in that directory, I believe in standard sort order and gives each the 'start' argument. Then when the shutdown is run, it runs each with the 'stop' argument. To qualify for execution, the sctipt name must end in '.sh' and it must have execute persission. Some of them must be activated by putting a line in the /etc/rc.conf.local file (or just /etc/rc.conf if you prefer but I don't like to clutter it up too much) to set an appropriate environment variable. Most of them are in the form of something like UTILITY_RUN=YES or similar. Check the script and the utility documentation to see what sort of environment variable must be set. The script checks for whatever environment variable it wants to when it runs to see what it should do. A very old fashioned and currently unsupported way was to put a command in the /etc/usr.local file, but that is no longer a good way to do it. ////jerry > > Joacim >