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

Re: Q re missing rc.local file



Gene Heskett wrote:
> I have a fairly lengthy list of things I've added to 
> the /etc/rc.d/rc.local file, which is softlinked from S99local in the 
> various rcX.d directories in RH & Fedora and is the last thing 
> executed before the login screen in a RG/Fedora runlevel 3 boot.

On Debian there is no difference (by default) to the different run
levels.  This is an often confusing point to people switching to
Debian.  And the converse that run levels are meaningful to people
switching to Red Hat.

There is a reason the run levels are not really important.  Here is
the rationale as I see it.  On Debian using APT managing software is
very easy.  So if you want something to run then you install it.  If
you don't want something to run then uninstall it.

Want to install the Gnome flavor of xdm?  Just install it.

  apt-get install gdm

Decide you don't like it?  Then remove it.

  apt-get remove gdm

Decide you want to put it back?  Then put it back.

  apt-get install gdm

Because configuration files are not removed any previous configuration
that you used will still be present.  The second installation won't
need to ask you those same questions again because you always answer
them.  It is a trivial installation.  Run levels do not come into play
unless you want them to.  You can always configure gdm to only start
in run level 5 and then use run levels to control whether it starts or
not.  But distros have been taught that most users require a graphical
login.  Those that want a text based login are in the minority and
will have to configure the system for that themselves.  And usually
the people who want a text mode login are fully capable so no problem.

Also in general when something is installed then it will be running.
There is no need to do extra processing such as running "chkconfig
daemon on" and then also running "service daemon start" in order to
finish things off.

Of course I am just using gdm as an example.  But any in that class
are the same such as Postfix.  If you install Postfix it will remove
Exim, Sendmail, or other MTAs.  Because normally you only run one
daemon on the SMTP port 25.  So installing one pushes the other out.
If you want to switch MTA programs then simply install the one that
you want to run.  There is no need for chkconfig on a Debian system.

In some of the lessor distros this is not the case.  User's there have
been conditioned that installing software is hard.  The only time you
can count on it working is at initial system installation time from
the cdroms.  So they try to install everything that they can at at
that time.  Because if they wait six months and then try to install
something like postfix then they get into a dependency hell where they
can't actually install it because all of the libraries have drifted.
Of course in very recent times there is apt4rpm and yum from the user
community to address these problems.  But still the legacy is there.

This mentality means that most of those installations have both
sendmail and postfix installed at the same time for one example.  But
only one is configured to run.  And installing something like BIND
does not mean that it will be configured to run.  So on those distros
you need to use 'chkconfig' to stitch in the rc scripts and then
'service' get it going.  But those operations are not needed nor
desired on Debian systems.

Okay, that was a little long.  But I think necessary to set the
process model of the system and why things are different on the
different systems.

> Stuff like a 4 line stanza that sets up and runs my setiathome admin 
> script before I'm even logged in as any user, so it runs regardless 
> of the login state of anyone.
>
> So where do I put the 'local' stuff in a debian install?
>
> I could use a short tutorial on the debian setup in re the various 
> rcX.d directories if someone has the time, or a pointer to a manpage 
> if there is one.

There is no default "local" rc script.  Which is perhaps a shame
because this is an often asked question.  But there is a template that
you can use to easily create one for yourself.

  cd /etc/init.d
  cp skeleton localrc
  editor localrc  # edit as you desire

That file has examples of almost everything in it.  You won't need
almost everything in your copy.  Please delete what you don't need.
In fact it may be better to pick an active working script and use it
instead.  You will be ahead in terms of avoiding the noise.  But
skeleton is still a good example because it does have a lot of stuff.

  cp cron localrc
  editor localrc  # edit as you desire

Of course that is a traditional daemon startup.  If you just want to
run commands then you might find hwclock.sh more to your liking.

  cp cron localrc
  editor localrc  # edit as you desire

In any case, there is a tool to set up the symlinks that can be
thought of as a chkconfig like tool.

  update-rc.d localrc defaults

This is really a scripting interface.  So normally users don't need to
know about the command.  But it is used in packages in the postinst
script.  And the reverse removal is 'update-rc.d localrc remove'.

And there are various packages and programs to help manage run levels
and other things.  These three come to mind.

  sysvconfig
  rcconf
  sysv-rc-conf

Hope this helps.

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: