LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 06-17-2006, 12:50 AM   #1
jtmoon
LQ Newbie
 
Registered: Jun 2006
Location: WA, USA
Distribution: Fedora Core 10
Posts: 15

Rep: Reputation: 5
Question how does system-config-services know the correct order for service startup ?


Is it taken from a simple text file?
Is it hardcoded into the binary?
Is it from rand()?
Is it based on the position of Jupiter in relation to Saturn?

It's a small curiosity I for which I would like an answer.

Yes, this could also fit into the RedHat and Fedora forums.

-J Tom Moon
 
Old 06-17-2006, 01:08 AM   #2
GrueMaster
Member
 
Registered: Aug 2005
Location: Oregon
Distribution: Kubuntu.
Posts: 848

Rep: Reputation: 30
Iff you look in /etc, you will find several subdirectories and configuration files. One of these directories contains the startup scripts for all of the system services (/etc/init.d). The order in which these scripts is executed is a semi-complex operation beginning within each one of these scripts. If you look at one of these scripts, near the top wil be a line as follows:

# chkconfig: 35 91 9

This is read by a script called "chkconfig". chkconfig can add a script to the runtime directories (/etc/rc[1-5].d) in the correct order of execution. If you look at /etc/rc5.d, you will notice several sympolic links that start with either an S or a K, followed by two numbers and the name of the service. When the init process is booting up, it first determines which runlevel to start in by reading the /etc/inittab file, then executing each script in order. The K, means to kill a service when entering this runlevel, an S means to start the service.

The numbers give each service an order of precidence. For example, you don't want your system running the file or web server services before the network has started. You also don't want the network to start before the system has had a chance to discover if there is a new network card or other hardware that needs configuring. Currently, each service waits for the previous service to finish initializing (pass or fail, they still wait). Work is currently under way for processes to be brought up in parallel, which would greatly spead up the Linux boot process. Things like the background virus scanning software (clamav) could be started while waiting for the network to retrieve an ip address, or the XWindows system could be started while wating for the print services to initialize.
 
Old 06-17-2006, 01:16 AM   #3
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Basically, the Linux kernel starts the "init" program (process ID "1"), "init" executes the stuff listed in "/etc/inittab" (depending on which "run level" states it passes through), and each "run level" invokes zero or more startup or shutdown scripts located in /etc/rc.d/rcX.d (where "X" is run level 0, 1, 2, 3, 4, 5 or 6). The scripts are run consecutively, in alphabetic order.

For example, these are the scripts run for "init 3" (run level 3 == multi-user, text mode):
Code:
  ls /etc/rc.d/rc3.d =>
K04powersaved      K12nfs           S01isdn          S12kbd
K05haldaemon       K12nfsboot       S01random        S12mysql
K06cron            K14mdnsd         S01resmgr        S12running-kernel
K06smbfs           K14portmap       S04boot.udev     S12splash
K07apache2         K14splash_early  S05network       S12sshd
K08nscd            K14vmware        S06dbus          S13cups
K08postfix         K15nmb           S06syslog        S14nscd
K08smb             K16dbus          S07nmb           S14postfix
K08xinetd          K16syslog        S08mdnsd         S14smb
K09cups            K17network       S08portmap       S14xinetd
K10acpid           K18boot.udev     S08splash_early  S15apache2
K10alsasound       K21fbset         S08vmware        S16cron
K10mysql           K21isdn          S10nfs           S16smbfs
K10running-kernel  K21random        S10nfsboot       S17haldaemon
K10splash          K21resmgr        S12acpid         S18powersaved
K10sshd            S01fbset         S12alsasound
Some of these scripts start daemons (for example, "mysqld"), others just do one-time setup ("S" for Start) or shutdown ("K" for Kill) activity.

Here's a link that explains further:
http://www.gnoppix.org/pages/rute/node35.html

PS:
I was typing my (long-winded!) explanation at the same time as GrueMaster. We're both saying the same thing - apologies for any duplicate redundancy ;-)

Last edited by paulsm4; 06-17-2006 at 01:19 AM.
 
  


Reply

Tags
fedora, redhat, services


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Telsasoft, a Telecommunications Service Assurance Software Company Based in Minneapolis, Minnesota Received Order for a Set of GSM CDR (Call Detail Record) Reports from a Regional GSM Network Service LXer Syndicated Linux News 0 01-03-2006 09:46 PM
services wont start, nor service-config birras Fedora 3 10-24-2004 08:22 PM
resort order of startup services robert_edwards Fedora 0 07-29-2004 06:30 AM
add service to "system services list"? frieza Linux - Software 2 05-05-2004 11:51 AM
How can it ell Grip where put my ripped files and sort the in the correct order MvD Linux - Software 2 10-16-2003 03:10 AM


All times are GMT -5. The time now is 08:22 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration