📄 sysvinit.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content= "application/xhtml+xml; charset=iso-8859-1" /> <title> 10.62. Sysvinit-2.86 </title> <link rel="stylesheet" href="../stylesheets/lfs.css" type="text/css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.69.1" /> <link rel="stylesheet" href="../stylesheets/lfs-print.css" type= "text/css" media="print" /> </head> <body id="lfs" class="CLFS-SVN-20060417-x86_64-Multilib"> <div class="navheader"> <div class="headertitles"> <h4> Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-x86_64-Multilib </h4> <h3> Chapter 10. Installing Basic System Software </h3> </div> <ul class="headerlinks"> <li class="prev"> <a accesskey="p" href="sysklogd.html" title= "Sysklogd-1.4.1">Prev</a> <p> Sysklogd-1.4.1 </p> </li> <li class="next"> <a accesskey="n" href="tar.html" title="Tar-1.15.1">Next</a> <p> Tar-1.15.1 </p> </li> <li class="up"> <a accesskey="u" href="chapter.html" title= "Chapter 10. Installing Basic System Software">Up</a>. </li> <li class="home"> <a accesskey="h" href="../index.html" title= "Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-x86_64-Multilib"> Home</a> </li> </ul> </div> <div class="wrap" lang="en" xml:lang="en"> <div class="titlepage"> <h1 class="sect1"> 10.62. Sysvinit-2.86 </h1> </div> <div class="package" lang="en" xml:lang="en"> <p> The Sysvinit package contains programs for controlling the startup, running, and shutdown of the system. </p> <div class="segmentedlist"> <div class="seglistitem"> <div class="seg"> <strong><span class="segtitle">Installation depends on:</span></strong> <span class="seg">Binutils, Coreutils, GCC, Glibc, Make, and Sed</span> </div> </div> </div> </div> <div class="installation" lang="en" xml:lang="en"> <div class="titlepage"> <h2 class="sect2"> 10.62.1. Installation of Sysvinit </h2> </div> <p> When run-levels are changed (for example, when halting the system), <span><strong class="command">init</strong></span> sends termination signals to those processes that <span><strong class= "command">init</strong></span> itself started and that should not be running in the new run-level. While doing this, <span><strong class="command">init</strong></span> outputs messages like “<span class="quote">Sending processes the TERM signal</span>” which seem to imply that it is sending these signals to all currently running processes. To avoid this misinterpretation, modify the source so that these messages read like “<span class="quote">Sending processes started by init the TERM signal</span>” instead: </p> <pre class="userinput"><kbd class="command">sed -i 's@Sending processes@& started by init@g' \ src/init.c</kbd></pre> <p> Compile the package: </p> <pre class="userinput"><kbd class="command">make -C src clobbermake -C src CC="gcc ${BUILD64}"</kbd></pre> <p> Install the package: </p> <pre class="userinput"><kbd class="command">make -C src install</kbd></pre> </div> <div class="configuration" lang="en" xml:lang="en"> <div class="titlepage"> <a id="conf-sysvinit" name="conf-sysvinit"></a> <h2 class="sect2"> 10.62.2. Configuring Sysvinit </h2> </div> <p> Create a new file <tt class="filename">/etc/inittab</tt> by running the following: </p> <pre class="userinput"><kbd class="command">cat > /etc/inittab << "EOF"<tt class="literal"># Begin /etc/inittabid:3:initdefault:si::sysinit:/etc/rc.d/init.d/rc sysinitl0:0:wait:/etc/rc.d/init.d/rc 0l1:S1:wait:/etc/rc.d/init.d/rc 1l2:2:wait:/etc/rc.d/init.d/rc 2l3:3:wait:/etc/rc.d/init.d/rc 3l4:4:wait:/etc/rc.d/init.d/rc 4l5:5:wait:/etc/rc.d/init.d/rc 5l6:6:wait:/etc/rc.d/init.d/rc 6ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r nowsu:S016:once:/sbin/sulogin1:2345:respawn:/sbin/agetty -I '\033(K' tty1 96002:2345:respawn:/sbin/agetty -I '\033(K' tty2 96003:2345:respawn:/sbin/agetty -I '\033(K' tty3 96004:2345:respawn:/sbin/agetty -I '\033(K' tty4 96005:2345:respawn:/sbin/agetty -I '\033(K' tty5 96006:2345:respawn:/sbin/agetty -I '\033(K' tty6 9600# End /etc/inittab</tt>EOF</kbd></pre> <p> The <em class="parameter"><tt>-I '\033(K'</tt></em> option tells <span><strong class="command">agetty</strong></span> to send this escape sequence to the terminal before doing anything else. This escape sequence switches the console character set to a user-defined one, which can be modified by running the <span><strong class="command">setfont</strong></span> program. The <span><strong class="command">console</strong></span> initscript from the LFS-Bootscripts package calls the <span><strong class= "command">setfont</strong></span> program during system startup. Sending this escape sequence is necessary for people who use non-ISO 8859-1 screen fonts, but it does not affect native English speakers. </p> </div> <div class="content" lang="en" xml:lang="en"> <div class="titlepage"> <a id="contents-sysvinit" name="contents-sysvinit"></a> <h2 class="sect2"> 10.62.3. Contents of Sysvinit </h2> </div> <div class="segmentedlist"> <div class="seglistitem"> <div class="seg"> <strong><span class="segtitle">Installed programs:</span></strong> <span class="seg">halt, init, killall5, last, lastb (link to last), mesg, pidof (link to killall5), poweroff (link to halt), reboot (link to halt), runlevel, shutdown, sulogin, telinit (link to init), utmpdump, and wall</span> </div> </div> </div> <div class="variablelist"> <h3> <a id="id3701355" name="id3701355"></a>Short Descriptions </h3> <table border="0"> <col align="left" valign="top" /> <tbody> <tr> <td> <a id="halt" name="halt"></a><span class= "term"><span><strong class= "command">halt</strong></span></span> </td> <td> <p> Normally invokes <span><strong class= "command">shutdown</strong></span> with the <em class= "parameter"><tt>-h</tt></em> option, except when already in run-level 0, then it tells the kernel to halt the system; it notes in the file <tt class= "filename">/var/log/wtmp</tt> that the system is being brought down </p> </td> </tr> <tr> <td> <a id="init" name="init"></a><span class= "term"><span><strong class= "command">init</strong></span></span> </td> <td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -