-->

Previous | Table of Contents | Next

Page 153




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

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,


# 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

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,


# 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



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,


# 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



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.

To view a fax, you can use the fax command's view option. Figure 9.4 shows the fax views—

Page 154

for example,


# 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 ...



The fax program will cycle through the files and display each page with a viewer you've

Figure 9.4.
The fax command
automatically runs an
X11 graphic program
to view or print your
incoming faxes.

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,


# fax print 1204164646.001

/var/spool/fax/1204164646.001

1204164646.001 ...

This prints the first page of the incoming fax. You can print all the pages with


# fax print 1204164646*

If you want to delete a fax, you can use the fax command's rm command-line option—for

Page 155

example,


# 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

CAUTION
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.

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.

Sending Fax Documents with mgetty+sendfax

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.

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:


# ls -A

dialin.config   fax.deny        faxrunq.config  mgetty.config   voice.conf

fax.allow       faxheader       login.config    sendfax.config

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.

Next, you should edit the faxheader file, and enter your name and phone in the sample header

Page 156

line—for example,


FAX  FROM:  John H. Doe 1 202 555 1212     TO: @T@    PAGE: @P@ OF @M@

TIME SAVER
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.

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,


# which devices to use for outgoing faxes

#fax-devices tty4c:tty4d

fax-devices ttyS1

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,


# which fax number to transmit to the receiving station

#fax-id 49 89 xxxxxxxx

fax-id 1 202 555-1212

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,


# which command is used to dial out? (Could be ATD, ATDP, ATX3D0W...)

#dial-prefix ATD

ATDT

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.

You'll find this file in the source distribution of the mgetty+sendfax package at




http://sunsite.unc.edu/pub/Linux/system/serial/getty/mgetty+sendfax-1.0.0.tar.gz

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.

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,

Previous | Table of Contents | Next