From owner-freebsd-questions@FreeBSD.ORG Mon Mar 5 15:54:15 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6029216A400 for ; Mon, 5 Mar 2007 15:54:15 +0000 (UTC) (envelope-from jean.daigle@SolaceSystems.com) Received: from mail.allstreamits.com (mail.allstreamits.com [66.46.107.253]) by mx1.freebsd.org (Postfix) with ESMTP id 0E62C13C48E for ; Mon, 5 Mar 2007 15:54:14 +0000 (UTC) (envelope-from jean.daigle@SolaceSystems.com) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Mon, 5 Mar 2007 10:54:49 -0500 Message-ID: <6B865826E860EF42B3A387A03F39539616A0E26F@EX0004.AllstreamITS.local> In-reply-to: <20070305154404.GD3926@gizmo.acns.msu.edu> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Starting a service on boot Thread-Index: AcdfPgt3+C9dGccgSPeCUSj/ooq0hQAABOew References: <6B865826E860EF42B3A387A03F39539616917F69@EX0004.AllstreamITS.local> <20070305154404.GD3926@gizmo.acns.msu.edu> From: "Jean-Philippe Daigle" To: "Jerry McAllister" Cc: freebsd-questions@freebsd.org Subject: RE: Starting a service on boot 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, 05 Mar 2007 15:54:15 -0000 > -----Original Message----- > From: Jerry McAllister [mailto:jerrymc@msu.edu] > Sent: Monday, March 05, 2007 10:44 AM > To: Jean-Philippe Daigle > Cc: freebsd-questions@freebsd.org > Subject: Re: Starting a service on boot >=20 > On Mon, Mar 05, 2007 at 09:37:54AM -0500, Jean-Philippe Daigle wrote: >=20 > > Hello, > > > > I'm attempting to add a new program to the list of services starting at > > boot time on FreeBSD 6.1. Unfortunately, although running the script > > directly as root starts it up just fine, it's not starting at boot time. > > I've found documentation that says there are two basic steps to follow: > > > > 1) Create a script named, say, 'foo' starting the program, place it in > > /etc/rc.d/, and make sure it satisfies a few minimal requirements (see > > script below). > > > > 2) Edit rc.conf to add "foo_enable=3DYES" so the init system knows = to > > start the new program. > > > > I've done (2), and here's the script for (1) (anything between <> is me > > redacting a username, it's obviously not that way in the script): >=20 > A couple of comments before attemting to look at the script: >=20 > First, it should go in to '/usr/local/etc/rc.d', not just plain /etc/rc.d > The /etc/rc.d location is reserved for system stuff and may be nuked > (overwritten) in an upgrade. /usr/local/etc/rc.d is reserved for user > installed third party and locally written scripts and will generally be > preserved over upgrades. > Second, it needs to have execute permission set. > Third, the name used to have to end in '.sh'. I don't know if that > is still true. Mine all do. > Finally, the only value of putting something like 'foo_enable=3D"YES"' in > your rc.conf is if the script itself checks for the value on > a 'foo_enable' environmental variable. The system doesn't care > about it. I don't see this in your script. > Also, if you want messages to show in the logs, then you will have to > put writing them in to your script. >=20 > Once those things are dealt with, then see what that script does. >=20 > ////jerry >=20 Jerry M. and Roland S., Many thanks for your comments, that was it! Looks like renaming it to "cruisecontrol.sh" and moving it to /usr/local instead of the reserved /etc/rc.d got the script to run on boot. I still had a problem with which environment variables were set in the shell that starts up cruisecontrol, but that was rapidly fixed. Everything is working now. > Finally, the only value of putting something like 'foo_enable=3D"YES"' in > your rc.conf is if the script itself checks for the value on > a 'foo_enable' environmental variable. The system doesn't care > about it. I don't see this in your script. Oh, that's interesting. I thought that would control the script's startup. In any case, I'll add a check for it if it's ever needed. Thanks! Jean-Philippe Daigle =20