[Techtalk] Gnome

Conor Daly conor.daly at oceanfree.net
Sat Feb 23 21:19:50 EST 2002


On Fri, Feb 22, 2002 at 11:00:34AM -0800 or so it is rumoured hereabouts, 
Kai MacTane thought:
> At 2/22/02 05:47 AM , Jillian-Beth Stamos-Kaschke wrote:
> >As far as I know, Debian's default runlevel is 2, so if you haven't
> >changed the value /etc/inittab to something else, you should have a
> >look in /etc/rc2.d/ . If you see something there called S99xdm,
> >(which is the X display manager), rename it to K99xdm and next
> >time you reboot, you should be presented with a nice friendly prompt.
> 
> But then the machine *will* try to run X when the user tries to _leave_ 
> runlevel 2 -- e.g., when shutting down! This is probably not what the user 
> wants.
> 
> The K scripts are supposed to stop things, not start them.

The S and K scripts are just symlinks to the actual scripts which are 
typically found in /etc/rc.d/init.d/ .   On entering (only) a particular 
runlevel, the init program goes through the symlinks in the rcx.d directory 
for a that runlevel and, for each K?? symlink, it runs the script with the 
"stop" option while, for each S?? symlink, it runs the script with the 
"start" option.  So. renaming /etc/rc.d/rd2.d/S99xdm to K99xdm will stop xdm 
when entering runlevel 2 and that's it.  Of course, a script named S99...
will be the *last* thing started in a runlevel and, since it probably
depends on other services already running, should probably be stopped
*first*.  So, rename S99xdm to K00xdm rather than to K99xdm.

My /etc/rc.d/rc3.d/ ...

[cdaly at Valkerie cdaly]$ ls /etc/rc.d/rc3.d/
K20nfs@       S10network@  S20random@  S55sshd@        S80sendmail@
K20rwhod@     S12syslog@   S25netfs@   S56rawdevices@  S85gpm@
K45arpwatch@  S13portmap@  S35identd@  S56xinetd@      S85httpd@
S05kudzu@     S14nfslock@  S40atd@     S60lpd@         S90crond@
S08ipchains@  S16apmd@     S45pcmcia@  S75keytable@    S90xfs@

My /etc/rc.d/rc1.d/ ...

[cdaly at Valkerie cdaly]$ ls /etc/rc.d/rc1.d/
K00linuxconf@  K15gpm@    K30sendmail@    K60crond@   K84apmd@
K03rhnsd@      K15httpd@  K44rawdevices@  K60lpd@     K86nfslock@
K05keytable@   K20nfs@    K45arpwatch@    K65identd@  K87portmap@
K10windows@    K20rwhod@  K50xinetd@      K75netfs@   K88syslog@
K10xfs@        K25sshd@   K60atd@         K80random@  K90network@

Note in rc3.d two symlinks; S10network and S55sshd
Since ssh stuff will most likely be coming across a network, it makes
sense for the network to be started first.  In rc1.d the symlinks are
K25sshd and K90network.  So the ssh daemon will be stopped *before* the
network is stopped.

There's a very nice little program (comes with RedHat distros) called
chkconfig which allows you to specify which runlevel a particular service
should be started and stopped in.  You can add and remove services from
chkconfig management including your own home-grown or hand-rolled ones!
There's almost nothing to do with the scripts to be able to use them with
chkconfig, you just need to add two lines to the script

from "man chkconfig"...
RUNLEVEL FILES
       Each  service  which  should be manageable by chkconfig needs two or
       more commented lines added to its  init.d  script.  The  first line
       tells  chkconfig  what runlevels the service should be started in by
       default, as well as the start and stop priority levels. If the ser­
       vice should not, by default, be started in any runlevels, a - should
       be used in place of the runlevels list.  The second line contains a
       description  for  the  service,  and may be extended across multiple
       lines with backslash continuation.

       For example, random.init has these three lines:
       # chkconfig: 2345 20 80
       # description: Saves and restores system entropy pool for \
       #              higher quality random number generation.
       This says that the random script should be started in levels  2, 3,
       4,  and  5,  that its start priority should be 20, and that its stop
       priority should be 80.  You should be able to figure  out  what the
       description  says; the \ causes the line to be continued.  The extra
       space in front of the line is ignored.

chkconfig will also manage the xinetd based services in /etc/xinetd.d/

I kinda like it myself...

Conor
-- 
Conor Daly <conor.daly at oceanfree.net>

Domestic Sysadmin :-)
---------------------
Faenor.cod.ie
  7:35pm  up 37 days,  9:04,  0 users,  load average: 0.15, 0.03, 0.01
Hobbiton.cod.ie
  7:36pm  up 37 days,  9:20,  1 user,  load average: 0.00, 0.02, 0.00



More information about the Techtalk mailing list