From owner-freebsd-questions@FreeBSD.ORG Mon Mar 5 15:29:03 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 8D32116A403 for ; Mon, 5 Mar 2007 15:29:03 +0000 (UTC) (envelope-from rsmith@xs4all.nl) Received: from smtp-vbr9.xs4all.nl (smtp-vbr9.xs4all.nl [194.109.24.29]) by mx1.freebsd.org (Postfix) with ESMTP id 0DFFD13C4A5 for ; Mon, 5 Mar 2007 15:29:02 +0000 (UTC) (envelope-from rsmith@xs4all.nl) Received: from slackbox.xs4all.nl (slackbox.xs4all.nl [213.84.242.160]) by smtp-vbr9.xs4all.nl (8.13.8/8.13.8) with ESMTP id l25FT09V033715; Mon, 5 Mar 2007 16:29:01 +0100 (CET) (envelope-from rsmith@xs4all.nl) Received: by slackbox.xs4all.nl (Postfix, from userid 1001) id C2E3CB829; Mon, 5 Mar 2007 16:29:00 +0100 (CET) Date: Mon, 5 Mar 2007 16:29:00 +0100 From: Roland Smith To: Jean-Philippe Daigle Message-ID: <20070305152900.GA6326@slackbox.xs4all.nl> Mail-Followup-To: Jean-Philippe Daigle , freebsd-questions@freebsd.org References: <6B865826E860EF42B3A387A03F39539616917F69@EX0004.AllstreamITS.local> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DocE+STaALJfprDB" Content-Disposition: inline In-Reply-To: <6B865826E860EF42B3A387A03F39539616917F69@EX0004.AllstreamITS.local> X-GPG-Fingerprint: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 X-GPG-Key: http://www.xs4all.nl/~rsmith/pubkey.txt X-GPG-Notice: If this message is not signed, don't assume I sent it! User-Agent: Mutt/1.5.14 (2007-02-12) X-Virus-Scanned: by XS4ALL Virus Scanner 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:29:03 -0000 --DocE+STaALJfprDB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 05, 2007 at 09:37:54AM -0500, Jean-Philippe Daigle wrote: > Hello, >=20 > 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: >=20 > 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). The proper place is /usr/local/etc/rc.d. =20 > 2) Edit rc.conf to add "foo_enable=3DYES" so the init system knows to > start the new program. >=20 > 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 > (/etc/rc.d)$ cat cc Better to name the script and the service "cruisecontrol" instead of using the name of the system C compiler. It avoids confusion. > #!/bin/sh > # > # PROVIDE: cc > # REQUIRE: DAEMON I'd make that "REQUIRE: mountlate" if /home is not on the / partition. =20 > . /etc/rc.subr >=20 > name=3D"cc" > rcvar=3D`set_rcvar` > command=3D"/home//cruisecontrol.sh" > command_args=3D"&" > cc_user=3D"" Does /home//cruisecontrol.sh needs cc_user? This environment variable is only available in this subshell. It is not exported, so /home//cruisecontrol.sh doesn't see it. Roland --=20 R.F.Smith http://www.xs4all.nl/~rsmith/ [plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated] pgp: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 (KeyID: C321A725) --DocE+STaALJfprDB Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.2 (FreeBSD) iD8DBQFF7Dc8EnfvsMMhpyURAprWAJ464QNOzvK45AYNgqiNhFbYbCJGGwCgjkqt Ji86wEsGbQs6h4ZuENQoODI= =tA2I -----END PGP SIGNATURE----- --DocE+STaALJfprDB--