Documentos de Académico
Documentos de Profesional
Documentos de Cultura
In this section we're going to talk about exactly what happens when the
system boots.
These messages are all printed by the kernel itself, as each device
driver is initialized.
First, we see that 20 KB have been allocated by the kernel for the "swap
cache,“
Then the console type is printed; note that this involves only the text
mode being used by the kernel, not the capabilities of your video card.
(Even an SVGA video card is reported as Ega+ as far as the console text
mode is concerned.)
means that the first serial device (/dev/ttyOO, or COM1) was detected at
Next, the sound-card driver is initialized; the names and addresses for the
various sound devices are printed
And so on
For example, each virtual console has a getty process running on it,
started by init. When you exit from a login session on one of the virtual
consoles, the getty process exits, and init starts a new one, allowing you
to log in again.
sample /etc/inittab
# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit
l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6
# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -h now
# When our UPS tells us power has failed, assume we have a few minutes
# of power left. Schedule a shutdown for 2 minutes from now.
# This does, of course, assume you have powerd installed and your
# UPS connected and working correctly.
pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down"
# If power was restored before the shutdown kicked in, cancel it.
pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled"
id: 3: initdefault:
The action field for this entry is initdefault, which causes the given
runlevel to be set to the default.
/etc/rc.d/rc.sysinit file
The next entry tells init to execute the script /etc/rc.d/rc.sysinit when the
system boots.
The action field is sysinit, which specifies that this entry should be
executed when init is first started at system boot.
/etc/rc.d/rc
The action field here is wait, which tells init to execute the given
command, and to wait for it to complete execution before doing
anything else.
/etc/rc.d/rcN.d directories
If you look at the code for /etc/rc.d/rc (it should be a shell script) you'll
see that it runs a series of scripts in /etc/rc.d/rcN.d where N is the
runlevel being started.
For runlevel 3, scripts in /etc/rc.d/rc3.d would be used.
/etc/rc.d/rc.local
/etc/rc.d/init.d/smb stop
/etc/rc.d/init.d/smb restart
Chkconfig tool
• Checkconfig tool lets you:
– List installed services
– Add a service
– Delete a service
– Associate a service with a runlevel
Listing Services
#chkconfig --list
Adding a service
• To add a service, you must first ensure that the
associated init.d script contains special
comments.
• The comment line contains the tokens
#chkconfig
And then lists the run level
#chkconfig 25 20 80
Adding a service
Deleting a service
Today’s Agenda
Exercise:
Homework
• Homework this week:
• Next week: