Starting a service on boot
jerrymc at msu.edu
Mon Mar 5 15:46:54 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).
> 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):
A couple of comments before attemting to look at the script:
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="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.
Once those things are dealt with, then see what that script does.
> (/etc/rc.d)$ cat cc
> # PROVIDE: cc
> # REQUIRE: DAEMON
> . /etc/rc.subr
> command="/home/<PATH HERE>/cruisecontrol.sh"
> cc_user="<BUILD USERNAME HERE>"
> load_rc_config $name
> run_rc_command "$1"
> I can also check if it's enabled:
> (/etc/rc.d)$ ./cc rcvar
> # cc
> I haven't found anything interesting in the system logs from the last
> boot - any ideas why it's not starting up?
> -Jean-Philippe Daigle
> freebsd-questions at freebsd.org mailing list
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
More information about the freebsd-questions