📄 467-470.html
字号:
<HTML>
<HEAD>
<TITLE>Using Linux:Managing Daemons</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!--ISBN=0789716232//-->
<!--TITLE=Using Linux//-->
<!--AUTHOR=William Ball//-->
<!--PUBLISHER=Macmillan Computer Publishing//-->
<!--IMPRINT=Que//-->
<!--CHAPTER=28//-->
<!--PAGES=467-470//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="../ch27/463-465.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="470-472.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H2><A NAME="Heading1"></A><FONT COLOR="#000077">CHAPTER 28<BR>Managing Daemons
</FONT></H2>
<P><I>By Jan Walter</I></P>
<DL>
<DD>Editing and creating run levels
<DD>Editing <TT>inittab</TT>
<DD>Using <TT>chkconfig</TT>
<DD>Editing startup and shutdown scripts
<DD>Customizing the logon greeting
<DD>Enabling and customizing the MOTD
<DD>Using the <TT>tksysv</TT> tool
<DD>Using the <TT>ntsysv</TT> tool
<DD>Enabling FTP access
<DD>Enabling a web server
</DL>
<P>Linux, and all other UNIX variants, start a number of services at system startup. It is these services—called <I>daemons</I>—that the users, and you, the administrator, interact with. To increase flexibility, all these systems give you the option of starting the system in different modes, called <I>run levels</I>, each of which configures the system to operate in a certain way. Understanding how the entire process works is fundamental to successfully managing a Linux system.</P>
<P>Many beginning administrators have trouble understanding <I>parent processes.</I> All processes on the system have a parent process, which starts the actual program. For example, every time you type <TT>ls</TT> at the command line, your shell starts the program <TT>ls</TT>—in this case, the shell is the parent process. <I>Login</I> is the parent process of the shell you get when you log on. The parent of all processes is called <TT>init</TT>; this process controls what happens when the system starts, and controls how the system runs.</P>
<P>Because Linux is a multiuser system, it must have several modes of operation. For example, the <TT>halt</TT> and <TT>reboot</TT> modes of operation make the system do things not typically associated with a valid state for an operating system. UNIX and Linux call the state of the operating system a run level. As shown in Table 28.1, six run levels are implemented for a stock Red Hat Linux system:</P>
<TABLE BORDER="2" BORDERCOLOR="#0000" ALIGN="CENTER">
<TR><TD><FONT SIZE="+1"><B>The two UNIX camps</B></FONT>
<BR>The UNIX world is divided into two differing camps—Berkeley and AT&T. Because Linux straddles the ground between the two, each distribution has a lot of leeway as to how to implement the run-level mechanism.</TABLE>
<TABLE WIDTH="100%">
<CAPTION ALIGN=LEFT><B>TABLE 28.1</B> Linux system run levels
<TR>
<TH COLSPAN="3"><HR>
<TR>
<TH WIDTH="20%" ALIGN="LEFT">Run Level
<TH WIDTH="25%" ALIGN="LEFT">Name
<TH WIDTH="45%" ALIGN="LEFT">Purpose
<TR>
<TH COLSPAN="3"><HR>
<TR>
<TD VALIGN="TOP">0
<TD VALIGN="TOP">Halt
<TD>When the system is at this run level, nothing is running, and the disk volumes are not mounted. The only things you can do at this level are to turn off the system or press Crtl+Alt+Delete.
<TR>
<TD VALIGN="TOP">1
<TD VALIGN="TOP">Single User Mode
<TD>This is the systems maintenance mode. This mode guarantees that only the person at the console of the system is able to use the system. This mode is used for checking disks or for serious system-maintenance work that cannot be done when users are on the system or when processes are accessing the disk.
<TR>
<TD VALIGN="TOP">2
<TD VALIGN="TOP">Multi-User Mode Without Networking
<TD>This allows multiple logons via the console sessions or via serial ports, but does not configure the network, or anything that relates to it, such as the Web and samba servers. Typically, this run level is not used, but some sysadmins use it to make changes to network configurations without having to kick all the users off the system. On some other systems, this run level only disables <TT>nfs</TT>, the network file system.
<TR>
<TD VALIGN="TOP">3
<TD VALIGN="TOP">Multi-User Mode
<TD>This is the normal operating mode for which Linux is configured. All services required for the full capability of the system are started.
<TR>
<TD VALIGN="TOP">4
<TD VALIGN="TOP">Multi-User Mode, Spare
<TD>This mode is a spare multiuser mode. On Red Hat systems, it does pretty much the same things that level 3 does. Since it’s a spare, you can test new configurations with this run level before rolling out a configuration to run level 3.
<TR>
<TD VALIGN="TOP">5
<TD VALIGN="TOP">XDM Mode
<TD>This mode keeps XDM, the X11 logon manager, running. Its most notable change is that you now get a graphical logon prompt, and the user’s X11 configuration starts up immediately after logon. This is great for systems that are used as workstations rather than network servers, since workstations are not normally running (many) other services that may need the extra memory this takes. Take my advice: For high-load servers, you don’t want to start at this run level.
<TR>
<TD VALIGN="TOP">6
<TD VALIGN="TOP">Reboot
<TD>This run level’s ultimate goal is to reboot your Linux computer. No services should be running when the computer finally reboots.
<TR>
<TD COLSPAN="3"><HR>
</TABLE>
<P>The point to remember for both run levels 0 and 6 is this: It’s not the run level itself that is significant, it’s <I>getting there</I> that matters. In the process of switching run levels, <TT>init</TT> starts and stops the services to make the system conform to the specification of that run level. This is a complicated way of saying that if a process is called for at the run level where the system is (or is going to), <TT>init</TT> makes sure that it’s running. The opposite also applies—if a service is not called for at the run level the system is going to, <TT>init</TT> stops it.</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="../ch27/463-465.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="470-472.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -