📄 0153-0156.html
字号:
<HTML>
<HEAD>
<TITLE>Sams Teach Yourself Linux in 24 Hours:Connecting to the Outside World:EarthWeb Inc.-</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=0672311623 //-->
<!-- TITLE=Sams Teach Yourself Linux in 24 Hours//-->
<!-- AUTHOR=Bill Ball//-->
<!-- PUBLISHER=Macmillan Computer Publishing//-->
<!-- IMPRINT=Sams//-->
<!-- CHAPTER=09 //-->
<!-- PAGES=0139-0160 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="0149-0152.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0157-0160.html">Next</A>
</CENTER></P>
<A NAME="PAGENUM-153"><P>Page 153</P></A>
<!-- CODE //-->
<PRE>
efax: 31:24 sent 20+2156 lines, 30948+0 bytes, 26 s 9522 bps
efax: 31:27 sent -> faxtest.txt.003
efax: 31:28 header:[97/12/04 16:29 William H. Ball (+657 0210)
Â--> 7201945 p. 4/4]
efax: 31:36 sent 20+2156 lines, 9023+0 bytes, 8 s 9023 bps
efax: 31:41 sent -> faxtest.txt.004
efax: 31:42 done, returning 0
</PRE>
<!-- END CODE //-->
<P>As you can see, the fax script automatically recognized that your file was a text file
because of the extension. To set your computer to automatically wait for incoming faxes, you
can use the fax script's wait command-line option—for example,
</P>
<!-- CODE SNIP //-->
<PRE>
# fax wait
running /usr/bin/fax answer
/usr/bin/efax: Thu Dec 04 16:42:22 1997 efax v 0.8a Copyright 1996 Ed Casas
</PRE>
<!-- END CODE SNIP //-->
<P>You could also use the background operator to put the shell script into the
background. You can check on the status of your Linux fax machine with the
status command-line option—for example,
</P>
<!-- CODE //-->
<PRE>
# fax status
USER PID %CPU %MEM SIZE RSS TTY STAT START TIME COMMAND
root 2304 0.3 1.3 1072 420 p3 S < 16:48 0:00 /usr/bin/efax
Â-d/dev/cua1 -v -v chewmainrxtf
from: /var/spool/fax/cua1.2304
efax: 48:56 opened /dev/cua1
efax: 48:58 waiting for activity
</PRE>
<!-- END CODE //-->
<P>This shows that the efax command is waiting on the
/dev/cua1 serial port for incoming faxes. To check whether you've received any faxes, you can use the
fax command's queue command-line option—for example,
</P>
<!-- CODE //-->
<PRE>
# fax queue
Fax files in /var/spool/fax :
-rw-r--r-- 1 root root 24090 Dec 4 16:47 1204164646.001
-rw-r--r-- 1 root root 40151 Dec 4 16:47 1204164646.002
-rw-r--r-- 1 root root 22157 Dec 4 16:48 1204164646.003
-rw-r--r-- 1 root root 32255 Dec 4 16:48 1204164646.004
-rw-r--r-- 1 root root 10325 Dec 4 16:48 1204164646.005
</PRE>
<!-- END CODE //-->
<P>
This output shows that a five-page fax is waiting in the
/var/spool/fax directory (created automatically when you first run the
fax command with the wait command-line option).
You can tell that the five files are pages of the same fax by the filenames, which are the date
and time, followed by the page number as an extension.
</P>
<P>To view a fax, you can use the fax command's
view option. Figure 9.4 shows the fax views—
</P>
<A NAME="PAGENUM-154"><P>Page 154</P></A>
<P>for example,
</P>
<!-- CODE //-->
<PRE>
# fax view 1204164646*
/var/spool/fax/1204164646.001
/var/spool/fax/1204164646.002
/var/spool/fax/1204164646.003
/var/spool/fax/1204164646.004
/var/spool/fax/1204164646.005
1204164646.001 ...
1204164646.002 ...
1204164646.003 ...
1204164646.004 ...
1204164646.005 ...
</PRE>
<!-- END CODE //-->
<P>The fax program will cycle through the files and display each page with a viewer
you've
</P>
<P>Figure 9.4.<BR>
The fax command<BR> automatically runs an<BR> X11 graphic
program<BR> to view or print your<BR> incoming faxes.<BR>
<a href="javascript:displayWindow('images/ch09fg04.jpg', 288, 216)"><img src="images/tn_ch09fg04.jpg"></a><BR>
</P>
<P>specified in the fax shell script. You can use the X11
xv client to print your faxes, or you can try the
fax command's print command-line option to print your faxes—for example,
</P>
<!-- CODE SNIP //-->
<PRE>
# fax print 1204164646.001
/var/spool/fax/1204164646.001
1204164646.001 ...
</PRE>
<!-- END CODE SNIP //-->
<P>This prints the first page of the incoming fax. You can print all the pages with
</P>
<!-- CODE SNIP //-->
<PRE>
# fax print 1204164646*
</PRE>
<!-- END CODE SNIP //-->
<P>If you want to delete a fax, you can use the
fax command's rm command-line option—for
</P>
<A NAME="PAGENUM-155"><P>Page 155</P></A>
<P>example,
</P>
<!-- CODE //-->
<PRE>
# fax rm 120417243*
/var/spool/fax/1204172431.001 /var/spool/fax/1204172431.004
/var/spool/fax/1204172431.002 /var/spool/fax/1204172431.005
/var/spool/fax/1204172431.003
deleted 1204172431.001
deleted 1204172431.002
deleted 1204172431.003
deleted 1204172431.004
deleted 1204172431.005
</PRE>
<P>
<CENTER>
<TABLE BGCOLOR="#FFFF99">
<TR><TD><B>
CAUTION
</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
The fax command's rm command-line option is potentially dangerous and
may delete files in the current directory, especially if you just use a plain asterisk
(*) as a filename. You should specify the fax filenames explicitly when using
this command-line option.
</BLOCKQUOTE></TD></TR>
</TABLE></CENTER>
</P>
<P>The efax family of commands is a simple and versatile way to send and receive faxes
with Linux. The fax command has more commands than are documented in the manual
page, including support for voice modems and creating cover pages. Read the
fax command itself for more details.
</P>
<H4><A NAME="ch09_ 14">
Sending Fax Documents with mgetty+sendfax
</A></H4>
<P>The mgetty+sendfax is a package of software, using the
mgetty command, which you install in /etc/inittab much like the
uugetty example shown previously, and the sendfax program, which
is used to send faxes. The installation and configuration of this software is a little
more complicated than setting up efax. This section shows you how to set up, configure, and
use this software to send and receive fax documents with your modem.
</P>
<P>This package of software includes many files (too many to list here). The examples in
this section concentrate on the important ones, and first show you how to configure the
sendfax software and quickly send a fax. Your first step is to make sure that you're logged in as
the root operator. You'll need to change directory to
the mgetty+sendfax directory under the
/etc/ directory. You'll see a number of files there, such as the following:
</P>
<!-- CODE SNIP //-->
<PRE>
# ls -A
dialin.config fax.deny faxrunq.config mgetty.config voice.conf
fax.allow faxheader login.config sendfax.config
</PRE>
<!-- END CODE SNIP //-->
<P>Your first job is to create the fax.allow and
fax.deny files if they don't exist. In the
fax.allow file, enter the names of users you'd like to allow to have fax service. You should enter at
least two names: root and your username.
</P>
<P>Next, you should edit the faxheader file, and enter your name and phone in the sample
header
</P>
<A NAME="PAGENUM-156"><P>Page 156</P></A>
<P>line—for example,
</P>
<!-- CODE SNIP //-->
<PRE>
FAX FROM: John H. Doe 1 202 555 1212 TO: @T@ PAGE: @P@ OF @M@
</PRE>
<!-- END CODE SNIP //-->
<TABLE BGCOLOR=#FFFF99>
<TR><TD>TIME SAVER</TD></TR>
<TR><TD>
<BLOCKQUOTE>
You should use the comment character, #, when you make changes to the
sendfax configuration files, and retype your changes on a new line. This will save
you trouble if you make mistakes and need to return the file back to its original state.
</BLOCKQUOTE>
</TD></TR>
</TABLE>
<P>The sample header line will appear across the top of your faxed pages on the receiving
fax machine. Next, you should edit the
sendfax.config file, and first change the name of the
device your modem is attached to (for example,
/dev/ttyS1 for COM2)—for example,
</P>
<!-- CODE SNIP //-->
<PRE>
# which devices to use for outgoing faxes
#fax-devices tty4c:tty4d
fax-devices ttyS1
</PRE>
<!-- END CODE SNIP //-->
<P>This tells the sendfax programs that your fax modem is attached to
/dev/ttyS1. Next, enter the fax number (yours), which will be sent to the remote fax machine—for example,
</P>
<!-- CODE SNIP //-->
<PRE>
# which fax number to transmit to the receiving station
#fax-id 49 89 xxxxxxxx
fax-id 1 202 555-1212
</PRE>
<!-- END CODE SNIP //-->
<P>This will identify your fax machine to the remote fax. You'll also need to enter the type
of dialing you'd like to use when sending a fax—for example,
</P>
<!-- CODE SNIP //-->
<PRE>
# which command is used to dial out? (Could be ATD, ATDP, ATX3D0W...)
#dial-prefix ATD
ATDT
</PRE>
<!-- END CODE SNIP //-->
<P>This tells the sendfax software that you'd like to dial out by using tone dialing. At this
point, you're almost ready to start sending faxes. Unfortunately, though, a file named
pbm2g3 is missing from the sendfax distribution. You'll need this file if you want to create
fax-format graphics files from text files you'd like to send.
</P>
<P>You'll find this file in the source distribution of the
mgetty+sendfax package at
</P>
<!-- CODE //-->
<PRE>
<a href="http://sunsite.unc.edu/pub/linux/system/serial/getty/mgetty+sendfax-1.0.0.tar.gz">
http://sunsite.unc.edu/pub/Linux/system/serial/getty/mgetty+sendfax-1.0.0.tar.gz</A>
</PRE>
<!-- END CODE //-->
<P>Download the file, decompress and unarchive it, and change directory to the
tools directory in the source folder, mgetty-1.0.0. Then, type
make. After the various programs build, you can copy the program
pbm2g3 to the /usr/bin directory. After you do this, the
sendfax program will work.
</P>
<P>To send a one-page fax by using the sendfax
program, you must first convert a text file into the Group 3 fax format. You can do this by using the graphics conversion program
pbmtext,
</P>
<P><CENTER>
<a href="0149-0152.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0157-0160.html">Next</A>
</CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -