📄 sysvinit.html
字号:
<HTML><HEAD><TITLE>Installing Sysvinit-2.83</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.63"><LINKREL="HOME"TITLE="Linux From Scratch"HREF="../index.html"><LINKREL="UP"TITLE="Installing basic system software"HREF="../chapter06/chapter06.html"><LINKREL="PREVIOUS"TITLE="Installing Sysklogd-1.4.1"HREF="../chapter06/sysklogd.html"><LINKREL="NEXT"TITLE="Installing Tar-1.13"HREF="../chapter06/tar.html"></HEAD><BODYCLASS="sect1"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">Linux From Scratch: Version 3.1</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="../chapter06/sysklogd.html">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 6. Installing basic system software</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="../chapter06/tar.html">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="sect1"><H1CLASS="sect1"><ANAME="ch06-sysvinit">6.51. Installing Sysvinit-2.83</A></H1><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><FONTCOLOR="#000000"><PRECLASS="screen">Estimated build time: 1 minuteEstimated required disk space: 630 KB</PRE></FONT></TD></TR></TABLE><DIVCLASS="sect2"><H2CLASS="sect2"><ANAME="AEN3695">6.51.1. Installation of Sysvinit</A></H2><P>When run levels are changed (for example when going to shutdownthe system) the init program is going to send the TERM and KILL signalsto all the processes that init started. But init prints a message to the screen saying "sending all processes the TERM signal" and the same for the KILL signal. This implies that init sends this signal to all the currently running processes, which isn't the case. To avoid this confusion, youchange the init.c file so that the sentence reads "sending all processes started by init the TERM signal" by running the followingcommands. If you don't want to change it, skip it.</P><P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><FONTCOLOR="#000000"><PRECLASS="screen"><TTCLASS="userinput"><B>cp src/init.c src/init.c.backup &&sed 's/\(.*\)\(Sending processes\)\(.*\)/\1\2 started by init\3/' \牋爏rc/init.c > tmp~ &&mv tmp~ src/init.c</B></TT></PRE></FONT></TD></TR></TABLE></P><P>Install Sysvinit by running the following commands:</P><P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><FONTCOLOR="#000000"><PRECLASS="screen"><TTCLASS="userinput"><B>make -C src &&make -C src install</B></TT></PRE></FONT></TD></TR></TABLE></P></DIV><DIVCLASS="sect2"><H2CLASS="sect2"><ANAME="AEN3705">6.51.2. Contents</A></H2><P>The Sysvinit package contains the halt, init, killall5, last, lastb, mesg, pidof, poweroff, reboot, runlevel, shutdown, sulogin,telinit, utmpdump, wall,</P></DIV><DIVCLASS="sect2"><H2CLASS="sect2"><ANAME="AEN3708">6.51.3. Description</A></H2><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN3710">6.51.3.1. halt</A></H3><P>Halt notes that the system is being brought down in the file /var/log/wtmp, and then either tells the kernel to halt, reboot or poweroff the system. If halt or reboot is called when the system is not in runlevel 0 or 6, shutdown will be invoked instead (with the flag -h or -r).</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN3713">6.51.3.2. init</A></H3><P>Init is the parent of all processes. Its primary role is to create processes from a script stored in the file /etc/inittab. This file usually has entries which cause init to spawn gettys on each line thatusers can log in. It also controls autonomous processes required by any particular system.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN3716">6.51.3.3. killall5</A></H3><P>killall5 is the SystemV killall command. It sends a signal to all processes except the processes in its own session, so it won't kill the shell that is running the script it was called from.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN3719">6.51.3.4. last</A></H3><P>last searches back through the file /var/log/wtmp (or the file designated by the -f flag) and displays a list of all users logged in (and out) since that file was created.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN3722">6.51.3.5. lastb</A></H3><P>lastb is the same as last, except that by default it shows a log of the file /var/log/btmp, which contains all the bad login attempts.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN3725">6.51.3.6. mesg</A></H3><P>Mesg controls the access to the users terminal by others. It's typically used to allow or disallow other users to write to his terminal.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN3728">6.51.3.7. pidof</A></H3><P>Pidof finds the process id's (pids) of the named programs and printsthose id's on standard output.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN3731">6.51.3.8. poweroff</A></H3><P>poweroff is equivalent to shutdown -h -p now. It halts the computer andswitches off the computer (when using an APM compliant BIOS and APM is enabled in the kernel).</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN3734">6.51.3.9. reboot</A></H3><P>reboot is equivalent to shutdown -r now. It reboots the computer.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN3737">6.51.3.10. runlevel</A></H3><P>Runlevel reads the system utmp file (typically /var/run/utmp) to locate the runlevel record, and then prints the previous and current system runlevel on its standard output, separated by a single space.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN3740">6.51.3.11. shutdown</A></H3><P>shutdown brings the system down in a secure way. All logged-in users are notified that the system is going down, and login is blocked.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN3743">6.51.3.12. sulogin</A></H3><P>sulogin is invoked by init when the system goes into single user mode (this is done through an entry in /etc/inittab). Init also tries to execute sulogin when it is passed the -b flag from the boot loader (eg, LILO).</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN3746">6.51.3.13. telinit</A></H3><P>telinit sends appropriate signals to init, telling it which runlevel tochange to.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN3749">6.51.3.14. utmpdump</A></H3><P>utmpdumps prints the content of a file (usually /var/run/utmp) onstandard output in a user friendly format.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN3752">6.51.3.15. wall</A></H3><P>Wall sends a message to everybody logged in with their mesg permission set to yes.</P></DIV></DIV><DIVCLASS="sect2"><H2CLASS="sect2"><ANAME="AEN3755">6.51.4. Dependencies</A></H2><P>Sysvinit-2.82 needs the following to be installed:</P><PCLASS="literallayout"><br>sh from the bash package<br><br>as from the binutils package<br>ld from the binutils package<br><br>chown from the fileutils package<br>install from the fileutils package<br>ln from the fileutils package<br>mknod from the fileutils package<br>rm from the fileutils package<br><br>cc from the gcc package<br><br>make from the make package<br><br>patch from the patch package<br></P></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="../chapter06/sysklogd.html">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="../index.html">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="../chapter06/tar.html">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Installing Sysklogd-1.4.1</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="../chapter06/chapter06.html">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Installing Tar-1.13</TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -