On Fri, 2006-01-27 at 19:50 -0700, Jacob Albretsen wrote:
> I tried to use the KDE tool to turn off some things at boot like mysql, but I 
> noticed that all the services are available at every run level, and mysql 
> starts at boot on levels 2, 3, 4, and 5.  So.... if I want to stop mysql from 
> turning on at boot, must I edit every singe runlevel with this tool?   And if 
> I want to start a service at boot, how do I know what levels to have it turn 
> on at boot and which ones not to? (other than init 6 of course) This just 
> seems odd to me, why would a service turn on four times at boot?  (I'm 
> totally showing make lack of knowledge in this area)

Runlevels are there for you to customize.  They don't necessarily mean a
lot in their default settings, and they aren't that useful to us desktop
users, but they are useful in a server setting.

On a server, for instance, you can define the runlevels 2-5 to be your
service levels.  Maybe you want all services to run in runlevel 5.
runlevel 4 could be all services except some server process, enabling
you to take the machine down just a notch for maintenance without
stopping all services.  

One example would be a small-business intranet server.  It runs web
(apache, tomcat, python) services, nfs and samba, and LDAP.  (an extreme
example, I know.)  At runlevel 5, everything would be running.  Runlevel
4  would be everything but web.  runlevel 3 would be only LDAP.  Thus
rather than remembering to start or stop all 4 init scripts that drive
web stuff (httpd, the tomcat engine, python app server, etc), you just
have to switch runlevels.  Taking the machine down to minimal service
level 3 would shut everything down but LDAP, which is an essential
service.  Then you could do your maintenance to nfs or samba or web, and
then bump the runlevel back up.  

> 
> I've done some Googling and found that each distro treats runlevels 
> differently.  The doc I found said that Debian considers 2, 3, 4, and 5 
> multi-user, thus causing me to be more confused.

Runlevel 1 is almost always considered "single-user."  This means only
one login console, no network, and no remote services.  So quite
literally only one person (the administrator) can use the box.  This is
not the normal state for a unix machine, so runlevels 2-5 are normal,
multi-user runlevels.  This means that the virtual consoles allow
multiple people to log in at once.  Possibly (depending on how it's set
up) network and sshd services are running too.

/etc/inittab controls what services are spawned at each runlevel.
You'll notice that inittab refers to the "rc" system for each runlevel.
This is what actually runs the various init scripts in the /etc/rc?.d
directories and those are the scripts you usually want to turn on and
off using the tools others have mentioned.  The default runlevel is set
in the inittab file or you can pass it in as boot parameter (append a
"2" or "3" to the kernel params in grub).

Debian normally only defines one runlevel that you use on a normal
basis.  Runlevel 2.  So 0=halt, 1=single user, 2=normal, and 6=reboot.

Fedora takes a more sane (I mean traditional SysV) approach and sets the
runlevels like so:
0=halt,1=single user,2=undefined,3=normal text-mode
only,4=undefined,5=normal with gui,6=reboot.

To me this makes it easier to pop between text-mode and graphics mode
(init 3, init 5).  Debian uses a standard rc init script to start X and
the login manager, whereas fedora spawns that through an actual inittab
entry (as did Mandraka or whatever they call it these days--okay
mandriva).

Perhaps a uug presentation on how Linux boots would be in order.
Specifically, init, inittab, the rc scripts, the X11 scripts (yet
another set of startup scripts).  Both Fedora and Ubuntu systems.  The
nice thing about linux is that is flexible and you can start it up
anyway you'd like.  That also makes it harder to understand, make
changes to the startup, and to deploy software to various distros where
you'll need to interface with the startup scripts.

Does anyone know if the Linux Standards Base defines the init system?  I
think it does somewhere.

> 
> So... perhaps someone can enlighten me on this subject or suggest a good tool 
> for the job?

On Fedora and Redhat systems I use ntsysv, chkconfig and others.  I
believe the proper debian tool has been suggested in another comment.

Michael


> 
> Thanks.
> 
> --------------------
> BYU Unix Users Group 
> http://uug.byu.edu/ 
> 
> The opinions expressed in this message are the responsibility of their
> author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG. 
> ___________________________________________________________________
> List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

--------------------
BYU Unix Users Group 
http://uug.byu.edu/ 

The opinions expressed in this message are the responsibility of their
author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG. 
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to