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 ;-)