I need to add commands that starts every time at system boot.

Clifton Royston cliftonr at lava.net
Sun Jun 7 22:21:13 UTC 2009


On Sun, Jun 07, 2009 at 04:12:41PM -0400, Scott Ullrich wrote:
> On Sun, Jun 7, 2009 at 3:36 PM, Chris Rees<utisoft at googlemail.com> wrote:
> > 2009/6/7 Clifton Royston <cliftonr at lava.net>:
> >
> >> If you feel you just *can't* do it via a script in
> >> /usr/local/etc/rc.d, which is the better way, add a script called
> >> /etc/rc.local and that will be run after all the other start-up steps.
> >
> > What's wrong with rc.local?
> 
> Probably stems from this discussion:
> http://lists.freebsd.org/pipermail/freebsd-stable/2007-July/035996.html

  No, I hadn't actually seen that discussion before.

  I used to work on BSD/OS, which had only the rc.local mechanism, and
when I first switched over to FreeBSD it was what I used.  Eventually I
got my head around the /etc/rc.d and /usr/local/etc/rc.d mechanism and
found it distinctly superior, so now I use it almost exclusively.

  Major highlights as to why are:  

 * You can readily implement whatever additional operations your service
   should support, such as restart/shutdown/whatever;
 * you can add or remove different services as discrete entities,
   without having to merge their change or removal into a single text
   file;
 * the startup/shutdown script can therefore readily be packaged for
   removal/installation together with any other software for the
   service in question;
 * you can get your service or operation run in a specific order
   relative to other services;
 * you can use the same script to start, shutdown, or restart the
   service at another time if appropriate or necessary

  It used to be a little harder to write them than a few lines in
rc.local, but now sourcing rc_subr provides shell functions which make
it trivial.

  These days I only use rc.local if I need to do some kind of
non-critical quick hack, e.g. for troubleshooting a problem.
  -- Clifton

-- 
    Clifton Royston  --  cliftonr at iandicomputing.com / cliftonr at lava.net
       President  - I and I Computing * http://www.iandicomputing.com/
 Custom programming, network design, systems and network consulting services


More information about the freebsd-stable mailing list