Date: Mon, 5 Mar 2007 10:54:49 -0500 From: "Jean-Philippe Daigle" <jean.daigle@SolaceSystems.com> To: "Jerry McAllister" <jerrymc@msu.edu> Cc: freebsd-questions@freebsd.org Subject: RE: Starting a service on boot Message-ID: <6B865826E860EF42B3A387A03F39539616A0E26F@EX0004.AllstreamITS.local> In-Reply-To: <20070305154404.GD3926@gizmo.acns.msu.edu> References: <6B865826E860EF42B3A387A03F39539616917F69@EX0004.AllstreamITS.local> <20070305154404.GD3926@gizmo.acns.msu.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
> -----Original Message----- > From: Jerry McAllister [mailto:jerrymc@msu.edu] > Sent: Monday, March 05, 2007 10:44 AM > To: Jean-Philippe Daigle > Cc: freebsd-questions@freebsd.org > Subject: Re: Starting a service on boot >=20 > On Mon, Mar 05, 2007 at 09:37:54AM -0500, Jean-Philippe Daigle wrote: >=20 > > 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). > > > > 2) Edit rc.conf to add "foo_enable=3DYES" 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): >=20 > A couple of comments before attemting to look at the script: >=20 > 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=3D"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. >=20 > Once those things are dealt with, then see what that script does. >=20 > ////jerry >=20 Jerry M. and Roland S., Many thanks for your comments, that was it! Looks like renaming it to "cruisecontrol.sh" and moving it to /usr/local instead of the reserved /etc/rc.d got the script to run on boot. I still had a problem with which environment variables were set in the shell that starts up cruisecontrol, but that was rapidly fixed. Everything is working now. > Finally, the only value of putting something like 'foo_enable=3D"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. Oh, that's interesting. I thought that would control the script's startup. In any case, I'll add a check for it if it's ever needed. Thanks! Jean-Philippe Daigle =20
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6B865826E860EF42B3A387A03F39539616A0E26F>