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

Re: Newbie comments & queries (numlock)

On Sat, Dec 08, 2001 at 08:15:35AM -0600, Colin Watson wrote:
> On Sat, Dec 08, 2001 at 03:58:05PM +0200, Ian Balchin wrote:
> > Karsten M. Self wrote:
> > > Place this in in your /etc/rc.d/rc.local to activate Numlock for the
> > > first six terminals:
> > > 
> > >     echo "Activating Numlock ..."
> > >     for i in 1 2 3 4 5 6; do
> > >   /usr/bin/setleds +num < /dev/tty${i} > /dev/null
> > >     done
> > 
> > Karsten,
> > 
> > Thanks, I have written this into /etc/rc.local which I created as there 
> > was not a file of this name.
> > 
> > However, it has made no change and I did not see the echo message so the 
> > file is maybe not being read.
> Debian doesn't use /etc/rc.local or anything like that. I'd recommend
> using a file in /etc/init.d, say /etc/init.d/numlock-off, and then using
> 'update-rc.d numlock-off start 99 S .' to have it run when you boot.

I'm not sure what rc.local is, I'm assuming you read about it
in some HOWTO or other documentation somewhere and that it is
the equivalent of the Debian /etc/init.d scripts.

When Linux starts up, it does what it is told in /etc/inittab.
At some point in /etc/inittab, there are references to init
scripts.  In Debian, those scripts are in /etc/init.d.  There
are links to these scripts from /etc/rc0.d, /etc/rc1.d, etc.

The xxx.d directories usually contain scripts which are to
be run using the run-parts script.  The point of this run-parts
script is that you can put in the initialisation and shutdown
scripts of various things without interfering (too much) with the
init and shutdown of other parts of the system.  You just drop
the appropriate scripts in the appropriate xxx.d directory,
and the run-parts script will notice and run the new script.

The init.d and rc[0-6S].d directories are a bit special in
that the links in rc[0-6S].d to scripts in /etc/init.d must
start with an S or a K, and that affects whether the script
will be called with a "start" or "stop" argument.
Also there is a two-digit number after the S or K which
determines the order the link is listed in the directory
(and the order in which the script is executed by run-parts).

So the scripts in init.d are the canonical list of all scripts
used to start your system, and depending on which directory
rc[0-6S].d that run-parts uses, then the contents of that
directory are the scripts that will be run.

The /etc/inittab file will choose a directory based on
what runlevel the system will use.  The default runlevel
is given earlier in the /etc/inittab.  You can
also choose a runlevel when you boot (not sure of
syntax but I know you can do it - handy for booting
in "maintenance" mode or "emergency" mode for
fixing a broken system).

So, as you might imagine, the contents of the rc[0-6S].d
directories are all links back to init.d.  Also the contents
are quite similar:  many of the same scripts that you want
to run for runlevel 1 are the same as the ones you want to
run for runlevel2.  So sysadmins made a script to help
people put in the links from the rc[0-6S].d directories
to the init.d directory - this script is called update-rc.d.
Read update-rc.d(8)
Yes, it has a weird name.

Sometimes there are file names in the rc[0-6S].d directories.
Some installation scripts of some packages are broken and
install script files right in the rc[0-6S].d directories.
It's no big deal, unless you are trying to install, uninstall
re-install stuff then it gets to be a pain because the
update-rc.d script won't work right with them.  (ie, removing
the scripts really removes them, rather than removing a link
to a script in init.d).

So Colin is saying you should make a little script called
/etc/init.d/numlock-off containing stuff to twiddle your
numlock, and run 'update-rc.d numlock-off start 99 S .'.  This
will create a link in /etc/rcS.d to /etc/init.d/numlock-off
called /etc/rcS.d/S99numlock-off.

I think the contents of rcS.d are run for every runlevel,
so you would only have to put a link to the numlock script
in the one /etc/rc?.d directory.

Welcome to the GNU age!   http://www.gnu.org

Reply to: