Starting a service on boot
rsmith at xs4all.nl
Mon Mar 5 15:29:03 UTC 2007
On Mon, Mar 05, 2007 at 09:37:54AM -0500, Jean-Philippe Daigle wrote:
> 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.
> # PROVIDE: cc
> # REQUIRE: DAEMON
I'd make that "REQUIRE: mountlate" if /home is not on the / partition.
> . /etc/rc.subr
> command="/home/<PATH HERE>/cruisecontrol.sh"
> cc_user="<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.
[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
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20070305/86811fc8/attachment.pgp
More information about the freebsd-questions