-->

Previous | Table of Contents | Next

Page 157

found under the /usr/bin directory with the pbm2g3 program—for example,


# cat myfile.txt | pbmtext | pbm2g3 > myfile.g3

This pipes the file myfile.txt through the pbmtext command, which outputs a portable bitmap graphics format into the pbm2g3 command, which then converts the piped stream of characters into the fax graphic format. After you do this, you can send the file (assuming that you're the root operator) with


# /usr/sbin/sendfax -v -l ttyS1 -C cls2 -r 5551212 myfile.g3

Trying fax device `/dev/ttyS1'... OK.

Dialing 5551212... OK.

sending `myfile.g3'...

This runs the sendfax program. The -v command-line option tells sendfax to give some feedback during the faxing operation. I've specified the ttyS1 serial port with the -l option, and sent the fax through a Class 2 fax modem with -C cls2 command-line option. The phone number 555-1212 was specified with the -r option, and the file, myfile.g3, was the file you created with the preceding command-line pipe.

If you would rather use a simpler approach, try the faxspool program, which automatically converts your text file, and places it in the fax spool directory under the /var/spool/fax directory—for example,


# faxspool 5551212 myfile.txt

spooling to /var/spool/fax/outgoing/F000010...

spooling myfile.txt...

myfile.txt is format: ascii

Aladdin Ghostscript 3.33 (4/10/1995)

Copyright (C) 1995 Aladdin Enterprises, Menlo Park, CA.  All rights reserved.

This software comes with NO WARRANTY: see the file COPYING for details.

Loading NimbusMonL-Bold font from /usr/share/ghostscript/fonts/n022004l.pfb...

Â1750128 436826 1320152 28679 0 done.

Printing myfile.txt

Page height = 67.

\nPutting Header lines on top of pages...

\nFax queued successfully. Will be sent at next `'faxrunq'' run.\n



The faxspool program requires only a phone number and filename, and has the advantage of handling multiple pages easily. You can see the number of faxes awaiting in the fax queue with the faxq command—for example,


#  faxq

F000010/JOB: queued by bball. 1 page(s) to 5551212

The faxq command reports on the number of jobs you've created, the number of pages, and the phone number of the remote fax machine. You can remove the waiting fax by using the faxrm command, as in the following example:


# faxrm F000010

The waiting faxes may be sent by the root operator by running the faxrunq command—for example,

Page 158


# faxrunq

processing F000011/JOB...

/usr/sbin/sendfax -v 5551212 f1.g3

Trying fax device `/dev/ttyS1'... OK.

Dialing 5551212... OK.

sending `f1.g3'...

command exited with status 0

    send mail to bball...

This shows that the faxrunq command uses the sendfax program to look at the fax queue in the /var/spool/fax directory, connects with the modem, dials out, and then sends the fax. One nice feature of the sendfax software package is that a mail message is automatically mailed to the fax sender to verify the faxing, as in the following example:


...

Subject: OK: your fax to 5551212



Your fax has been sent successfully at: \c

Thu Dec  4 23:45:26 EST 1997

\n\nJob / Log file:

phone 5551212

user bball

input myfile.txt

pages  f1.g3

Status Thu Dec 4 23:45:26 EST 1997 successfully sent

\nSending succeeded after 0 unsuccessful tries.



You can also set up your Linux system to automatically receive incoming faxes with the mgetty program. Used much like the uugetty program, mgetty also requires at least one change to its configuration file in the /etc/mgetty+sendfax directory. The change you can make (as the root operator) is to edit the phone identification entry in the file mgetty.config—for example,


# set the local fax station id

#fax-id 49 89 xxxxxxxx

fax-id 1 202 555 1212

This sets the local fax machine phone number. After you do this, you should edit the /etc/inittab file as described earlier, and use mgetty to listen to the serial port—for example,


3:2345:respawn:/sbin/mgetty -s 38400 ttyS1

CAUTION
As mentioned before, any edits of the /etc/inittab file are potentially hazardous. Always have a spare boot disk and make a backup of the file first.

After you make this change, save the file and reboot the computer. Now, not only can you receive faxes, but you also can dial in from an outside line and run Linux programs. To see if any faxes have arrived, you'll have to explicitly look at the /var/spool/fax/incoming

Page 159

directory—for example,


# ls -A /var/spool/fax/incoming

fn4878f9aS1-_IBM-APTIVA-M61-_.01  fn4878f9aS1-_IBM-APTIVA-M61-_.02

This shows that a two-page fax awaits reading. You can read the faxes by first converting them to the portable bitmap file format—for example,


# cat /var/spool/fax/incoming/*.01 | g32pbm > faxpage1.pbm

After you convert these fax files to the portable bitmap format, you can then use the X11 xv client or the ImageMagick display X11 program to read or print your faxes.

As you can see, you'll have several choices of faxing documents with Linux. The sendfax program, like the efax family of programs, also accepts other types of files to fax, and has many other options. Read the documentation for this program to find out the details.

Page 160

Previous | Table of Contents | Next