Neeraj Manral forced the electrons to say:
> I have a system as follows :
> [neeraj@anamika rc3.d]$ ls
<snip>
> S05apmd       S40atd        S55routed     S85httpd      S99local
> S10network    S40crond      S60lpd        S85sound      S99webmin
> In the above there are many programme  having the same no like webmin, local
> and linuxconf having S99 so is there any defined rule by which one decides
> which has to come first or it doesnot matter.
> 
> Just want to know  how these nos are decided ?

OK. I'll bite.

Just to take an example, here are the top few lines of my
/etc/rc.d/init.d/httpd:

#!/bin/sh
#
# Startup script for the Apache Web Server
#
# chkconfig: 345 85 15
# description: Apache is a World Wide Web server.  It is used to serve \
#              HTML files and CGI.

See the line that starts with chkconfig? That line tells /sbin/chkconfig
about this service. The three numbers are, in order

345: Runlevels to enable this particular service - httpd will be enabled
in runlevels 3, 4 and 5.
85: The start priority of the service.
15: The kill priority of the service.

Generally, the start and kill priorities will add up to 100. This
ensures that services are stopped in the reverse order they are started.

The program /sbin/chkconfig parses this line and creates the
symlinks from /etc/rc.d/rc$runlevel.d/S${startpriority}httpd and from
/etc/rc.d/rc$runlevel.d/K${stoppriority}httpd to /etc/rc.d/init.d/httpd
for all the runlevels mentioned.

Now, in my /etc/rc.d/rc (the script that is called at every runlevel by
init - it is set in /etc/inittab), there is a loop similar to

for file in /etc/rc.d/rc$runlevel.d/S*; do
    $file start
done

Here, bash's internal wildcard expansion makes sure that the files are
executed in order of increasing priority - ie, the ones with start
priority highest are executed last (maybe priority was the wrong word to
use here). You can verify this by just doing an echo /etc/rc.d/rc3.d/S*.

If the priority fields are same for two services, then that generally
means that they do not depend on each other, they can be started in any
order - in which case, they are started in alphabetic order.

How to decide the priority? It makes no sense to start dhcpd before
networking is initialized. So, dhcpd should have a higher second number
than network. Similarly, sendmail and apache should start after named. So,
sendmail's and apache's second numbers are higher than that of named. It
is basically a packaging time decision. Also, the kill priorities will
automatically adjust themselves to this if you follow the rule that
these priorities should add upto 100.

HTH,

Binand


----------------------------------------------
An alpha version of a web based tool to manage
your subscription with this mailing list is at
http://lists.linux-india.org/cgi-bin/mj_wwwusr

Reply via email to