Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Mar 2007 16:29:00 +0100
From:      Roland Smith <rsmith@xs4all.nl>
To:        Jean-Philippe Daigle <jean.daigle@SolaceSystems.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Starting a service on boot
Message-ID:  <20070305152900.GA6326@slackbox.xs4all.nl>
In-Reply-To: <6B865826E860EF42B3A387A03F39539616917F69@EX0004.AllstreamITS.local>
References:  <6B865826E860EF42B3A387A03F39539616917F69@EX0004.AllstreamITS.local>

next in thread | previous in thread | raw e-mail | index | archive | help

--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/<PATH HERE>/cruisecontrol.sh"
> command_args=3D"&"
> cc_user=3D"<BUILD USERNAME HERE>"

Does /home/<PATH HERE>/cruisecontrol.sh needs cc_user?

This environment variable is only available in this subshell. It is not
exported, so /home/<PATH HERE>/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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070305152900.GA6326>