Starting a service on boot

Roland Smith rsmith at
Mon Mar 5 15:29:03 UTC 2007

On Mon, Mar 05, 2007 at 09:37:54AM -0500, Jean-Philippe Daigle wrote:
> 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).

The proper place is /usr/local/etc/rc.d.
> 2) Edit rc.conf to add "foo_enable=YES" 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):
> (/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

I'd make that "REQUIRE: mountlate" if /home is not on the / partition.
> . /etc/rc.subr
> name="cc"
> rcvar=`set_rcvar`
> command="/home/<PATH HERE>/"
> command_args="&"

Does /home/<PATH HERE>/ needs cc_user?

This environment variable is only available in this subshell. It is not
exported, so /home/<PATH HERE>/ doesn't see it.

[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the freebsd-questions mailing list