⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 402-403.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:
<HTML>

<HEAD>

<TITLE>Special Edition Using Linux, Fourth Edition:Managing Multiple Processes</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=0789717468//-->

<!--TITLE=Special Edition Using Linux, Fourth Edition//-->

<!--AUTHOR=Jack Tackett//-->

<!--AUTHOR=Jr.//-->

<!--AUTHOR=Steve Burnett//-->

<!--PUBLISHER=Macmillan Computer Publishing//-->

<!--IMPRINT=Que//-->

<!--CHAPTER=19//-->

<!--PAGES=402-403//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="400-402.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="../ch20/405-408.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<P>Suppose you enter <TT><B>ps -f</B></TT> and see the following response:</P>

<!-- CODE SNIP //-->

<PRE>

UID        PID   PPID  C   STIME      TTY     TIME   COMMAND

chris      65     1    0   11:40:11   tty01   0:06   -bash

chris      71    65   61   11:42:01   tty01   0:14   total_updt inventory

chris     231    65   80   11:46:02   tty01   0:00   ps -f

chris     187    53   60   15:32:01   tty02 123:45   crunch stats

chris      53     1    0   15:31:34   tty02   1:06   -bash

</PRE>

<!-- END CODE SNIP //-->

<P>To kill process 187, normally you would enter <TT>kill 187</TT>. If you then enter <TT>ps -f</TT> again and see that the process is still there, you know the process is set up to ignore the <TT>kill</TT> command. To kill it unconditionally, enter <TT><B>kill -9 187</B></TT>. When you enter <TT>ps -f</TT> again, you see that the process is no longer around.</P>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>CAUTION:&nbsp;&nbsp;</B><BR>A disadvantage to using this unconditional version of the <TT>kill</TT> command is that <TT>kill -9</TT> doesn&#146;t allow a process to finish what it&#146;s doing before it terminates the process. If you use <TT>kill -9</TT> with a program that&#146;s updating a file, you could lose the updated material or the entire file.

<P>Use the powerful <TT>kill -9</TT> command responsibly. In most cases, you don&#146;t need the -9 option; the <TT>kill</TT> command, issued without arguments, stops most processes.<HR></FONT>

</BLOCKQUOTE>

</P>

<P><FONT SIZE="+1"><B>Termination of All Background Processes</B></FONT></P>

<P>To kill all background jobs, enter <TT><B>kill 0</B></TT>. Commands that run in the background sometimes initiate more than one process; tracking down all the PID numbers associated with the process you want to kill can be tedious. Because <TT>kill 0</TT> terminates all processes started by the current shell, it&#146;s a faster and less tedious way to terminate processes. Enter the <TT>jobs</TT> command to see what commands are running in the background for the current shell.</P>

<H3><A NAME="Heading19"></A><FONT COLOR="#000077">From Here&#133;</FONT></H3>

<P>This chapter presented the commands you need to manage multiple processes. You saw that you run multiple processes whenever you put jobs in the background with the ampersand (&#38;) or when you use pipes. You can schedule jobs at a specific time with the <TT>at</TT> command, at a time the system feels is appropriate with the <TT>batch</TT> command, and at regularly scheduled times with <TT>cron</TT> and <TT>crontab</TT>. For more information, see the following:</P>

<DL>

<DD><B>&#149;</B>&nbsp;&nbsp;The chapters in Part III, &#147;Managing the File System,&#148; discuss how to monitor and maintain your Linux system. System administration isn&#146;t an easy topic to learn and, in fact, requires a hands-on learning approach. This part of the book provides you with a basic understanding of the concepts and the tasks required of a systems administrator (often called a <I>sys admin</I>).

<DD><B>&#149;</B>&nbsp;&nbsp;Chapter 18, &#147;Understanding Linux Shells,&#148; provides the shell-specific information to program scripts to start, stop, and monitor processes on your Linux system.

</DL>

<P>In addition, check out the man pages for the various commands discussed in this chapter.

</P><P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="400-402.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="../ch20/405-408.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 + -