📄 0323-0325.html
字号:
<HTML>
<HEAD>
<TITLE>Developer.com - Online Reference Library - 0672311739:RED HAT LINUX 2ND EDITION:Essential System Administration</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=0672311739 //-->
<!-- TITLE=RED HAT LINUX 2ND EDITION //-->
<!-- AUTHOR=DAVID PITTS ET AL //-->
<!-- PUBLISHER=MACMILLAN //-->
<!-- IMPRINT=SAMS PUBLISHING //-->
<!-- PUBLICATION DATE=1998 //-->
<!-- CHAPTER=15 //-->
<!-- PAGES=0319-0340 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="0319-0322.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0326-0328.html">Next</A>
</CENTER></P>
<A NAME="PAGENUM-323"><P>Page 323</P></A>
<P>things are changed. If a task can be broken down into several small tasks, each with
individual test plans and back-out plans, then the job becomes much simpler.
</P>
<H4><A NAME="ch15_ 8">
Developing a Test Plan
</A></H4>
<P>Each change to a system needs to be tested. Even a small change, such as moving a file
from one location to another, should have a test plan. The test plan should be appropriate to
the task. In the example of moving a file, the test plan could be as simple as the following:
</P>
<OL>
<LI> Are there users or processes dependent upon the file?
<LI> If yes, can the users or processes still access the file?
<LI> If no, then make it available (change permissions, add directory to path, create
link, and so on).
<LI> Does it do what it is supposed to do?
<LI> If yes, okay; if no, then fix it.
</OL>
<P>A task as simple as moving a file requires five steps to properly test. Imagine the difficulty
of testing a large change.
</P>
<H4><A NAME="ch15_ 9">
Communicating Effectively and in a Timely Manner
</A></H4>
<P>Communicating the result of changes to the system is the final element of a successful
system change. Success does not necessarily mean that the task was completed without errors. In
fact, it could mean that the task could not be completed and the back-out plan was
successfully implemented. Communication also means letting the users know in advance of a change
that affects them.
</P>
<P>Communication, on a larger level, is any information passed between one user and another,
be it one-way communication or a dialog back and forth. Although it is imperative to have
this communication before, during, and after a system change, communication does not have
to nor should it stop there. Some system administrators communicate birthdays, local news,
jokes, and just about anything else to users on a regular basis.
</P>
<P>Many different tools can be used to communicate to users. In order to decide which tool
to use, you need to determine the purpose of the communication. For example, if you are
about to shut down a system, then that information needs to be communicated only to the
users currently logged on to the system. If, on the other hand, you want to announce a
birthday, then that information needs to be announced either to all users, or to all users who log on
to the system that day. Or, perhaps a user is remotely logged on to a system and is having
problems. A user with only one phone line cannot call in the problem without disconnecting.
This situation requires an entirely different form of communication. In the following sections,
several different tools for communication are discussed; some are commands, and others are
concepts. In addition, examples are given to illustrate which tool would be best given the particular
need. The following are the communication tools that are discussed in the upcoming sections:
</P>
<A NAME="PAGENUM-324"><P>Page 324</P></A>
<UL>
<LI> write: One-way communication with another user
currently logged on the system.
<LI> Echo to
the device: One-way communication with another user currently logged
on the system.
<LI> wall: One-way communication with all other users currently logged on the system.
<LI> talk: Interactive two-way communication with another user currently logged on
the system.
<LI> mesg: Controls message reception (talk and write) from other nonroot users
currently logged on the system.
<LI> motd: Message of the day received by users when they log on the system.
<LI> Electronic mail: For sending messages to and receiving messages from users whether
or not they are currently logged on the system.
<LI> Pre-login message
/etc/issue: The message is displayed on a terminal at time of
login. User does not have to log on to see this message.
</UL>
<H5><A NAME="ch15_ 10">write
</A></H5>
<P>The write command enables a user to write a message to a terminal. The syntax is the
command followed by the user ID of the person to whom you want to write. This places you in
a write shell. Anything you type, until you hit Ctrl+C, will be echoed to that user's display.
For example, I tried to write a message to my friend Rich, who was logged on to
mk.net:
</P>
<!-- CODE SNIP //-->
<PRE>
shell:/home/dpitts$ write rbowen
Hello Rich. How are you today?
shell:/home/dpitts$
</PRE>
<!-- END CODE SNIP //-->
<P>I didn't receive a reply.
</P>
<P>I wasn't sure that I was doing it right, so, I tried to send a message to myself. Before I
did, though, I turned off my mesg (mesg n). Here's what happened:
</P>
<!-- CODE SNIP //-->
<PRE>
shell:/home/dpitts$ write dpitts
write: you have write permission turned off.
</PRE>
<!-- END CODE SNIP //-->
<P>So, as a further test, I turned my mesg on (mesg
y) and tried again:
</P>
<!-- CODE //-->
<PRE>
shell:/home/dpitts$ mesg y
shell:/home/dpitts$ write dpitts
Message from dpitts@shell on ttyp0 at 20:10 ...
hello
hello
It enters what I type, and then echoes it back to me.
It enters what I type, and then echoes it back to me.
type <ctrl>c
type <ctrl>c
EOF
shell:/home/dpitts$
</PRE>
<!-- END CODE //-->
<A NAME="PAGENUM-325"><P>Page 325</P></A>
<P>It is displaying everything that I type, and then echoing it back to me with
write. That is why there are two identical lines. Had this gone to another terminal, then I would have seen
what I typed, and when I hit Enter, it would have been sent to the user I had indicated.
</P>
<P>You will notice that when I received the message, I got an initial line that told me who
the message was from, the tty (terminal type) I was on, and the time (local to the server):
</P>
<!-- CODE SNIP //-->
<PRE>
Message from dpitts@shell on ttyp0 at 20:10 ...
</PRE>
<!-- END CODE SNIP //-->
<P>After I had held down the Ctrl key and pressed the C key, it disconnected me from the
write program, indicated by the last line showing the end of the file
(EOF).
</P>
<CENTER>
<TABLE BGCOLOR="#FFFF99">
<TR><TD><B>
NOTE
</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
The write command writes to a terminal. The operating system doesn't think that it is
input from the person being written to. Therefore, even in an editing session when text
gets overwritten by the write command, the text is not really there. (On most editors Ctrl+L
will restore the original screen.) This also means that a person cannot send commands to
your terminal and have the computer execute them. It is strictly an output operation on
the receiver's end.
</BLOCKQUOTE></TD></TR>
</TABLE></CENTER>
<BR>
<H4>
Echo to the Device
</H4>
<P>Echoing to a device is similar to the write command. It has a similar result in that it
writes output to a device (such as a terminal), but it uses a different mechanism, and thus,
potentially, has different results. Let me see if I cannot send some output to someone's terminal as
I log on to mk.net.
</P>
<P>First, I look to see who is logged on:
</P>
<!-- CODE //-->
<PRE>
shell:/home/dpitts$ who -u
root ttyp1 Aug 13 10:01 00:05 (laptop.mk.net)
rbowen ttyp2 Aug 13 17:29 00:44 (rbowen.is.lex.da)
dpitts ttyp3 Aug 13 18:13 . (d13.dialup.seane)
</PRE>
<!-- END CODE //-->
<P>I am logged on (dpitts), the system administrator is logged on
(root) and my good friend Rich Bowen is logged on
(rbowen).
</P>
<P>Next, I try to echo a comment and send it to my terminal type:
</P>
<!-- CODE SNIP //-->
<PRE>
shell:/home/dpitts$ echo hello >/dev/tty/p3
bash: /dev/tty/p3: Not a directory
</PRE>
<!-- END CODE SNIP //-->
<P>Oops, I did it wrong. I should have sent it to
/dev/ttyp3, like this:
</P>
<!-- CODE SNIP //-->
<PRE>
shell:/home/dpitts$ echo hello /dev/ttyp3
hello /dev/ttyp3
</PRE>
<!-- END CODE SNIP //-->
<P><CENTER>
<a href="0319-0322.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0326-0328.html">Next</A>
</CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -