tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: /etc/rc.d/local starts not last

    Date:        Sun, 14 Apr 2019 11:50:47 +0200
    Message-ID:  <>

  | It is definitively not a technical problem: the rc.d structure
  | allows to solve my problem (as well as others'). It is more a lack of
  | consistency. rc.local is a convenience for putting miscellaneous
  | commands system wide when the system is ready (at least that is what the
  | documentation has always implied for me).

rc.local is ancient - it was created as somewhere for sites to put their
own startup, way before the rc.d structure appeared (so the BSD distributed
version, in /etc/rc, could remain unchanged and be easily updated).

Because it was an entry in a simple script (rc ran rc.local) it, and
everything else in rc, happened in a fixed order ... and rc.local happened
to come near the end.   Not for any particularly good reason, that's just
where it was put.   The "runs (nearly) last" part was just a statement of
fact (so it was useless to add anything local which needed to run
earlier - that still required local mods to /etc/rc).

With the rc (and rc.d) system, everything gets more flexible, and it
is trivial for anyone to add any rc.d/xxx script they need, and slot it
into the system wherever it belongs.

The single rc.local no longer really has a purpose - it was never really
very useful anyway (because there was, and still is, no reasonable way
to use it to run 2 different commands that need to be started at different
times.)   Anyone who uses it (I suspect that's a far smaller subset of
sites than you might think) should migrate to individual rc.d scripts
for individual commands.

Incidentally, the rc.d/local script hasn't been changed in any material
way since about NetBSD 1.6 (when support for the shutdown version was
added).   Its order and location in the sequence of things is the same
now as it was then.   And yes, I do mean 1.6, it certainly has had no
changes (at all) between NetBSD 3 and now.

The difference that you're seeing is that other rc.d scripts have been
added which also "run (nearly) last" - or even after last.  It used to be,
when rc.local was invented, and that doc was written, that the whole rc
system had to be finished before any logins became possible - that's no
longer true.  Anything which came just before logins, was "nearly last".

Just forget rc.local, and do things properly, as Martin suggested.


Home | Main Index | Thread Index | Old Index