original in en Mark Nielsen
Efax and fax are really the same thing. 'fax' is just a script calling efax.
Copy /usr/bin/fax to /usr/bin/fax_custom, and I changed the following lines:
FAXDIR=/var/spool/fax/incoming NAME="AudioBoomerang.com Computer Fax Server" FROM="+1 111 222 3333" ANSFNAME="fax_%Y%m%d_%H%M%S"
In /etc/inittab, I changed:
S0:2345:respawn:/bin/sh /usr/bin/fax_custom answer
efax -d /dev/ttyS0 -l "268 1162" -c 1,5 -r replyor
fax answer
If you don't want to have fax spawn in the background waiting for the next fax connection, then don't add changes to /etc/inittab I mentioned in the "Config Files" section.
If you issue the command:
ps auxw | grep efaxyou should see the efax session running in the background, like:
The nice thing is, if you kill the process id "1698", it will respawn and I believe reread the /usr/bin/fax_custom file. Thus, if you make changes to that file, just kill the process running efax before you try to fax to it when you want to test your configuration.
If you want to print it out, use efix like,
efix -ops fax_20020606_014847.001 | lpr
I would recommend that you print the file and then store it in a backup directory.
ln /usr/bin/fax /usr/bin/faxlpr
fax:lp=/dev/null:sd=/var/spool/fax:if=/usr/bin/faxlpr_perl:
mkdir /var/spool/lpd/fax touch /var/spool/lpd/fax/lock
/etc/rc.d/init.d/lpd restart
Now my changes are as follows:
l=`$FAX send "$num" fax$$` to `gs -q -sDEVICE=tiffg3 -dNOPAUSE -sOutputFile=fax_out fax$$ </dev/null` l=`efax -t $num fax_out` `rm fax_out`and also changed these three lines in the faxlpr section:
num=` echo "$cfile" | sed -e /^[^J]/d -e s/..//` host=`echo "$cfile" | sed -e /^[^H]/d -e s/..//` user=`echo "$cfile" | sed -e /^[^P]/d -e s/..//`
#!/usr/bin/perl my $String = ""; foreach my $Arg (@ARGV) { if ($Arg =~ /\-j/) { my $Copy = $Arg; $Copy =~ s/\-j//; open(FILE,">lock"); print FILE "hfA$Copy"; close FILE; } } my $Command = "/usr/bin/faxlpr"; system ($Command, @ARGV); print 1;
The perl script make it so faxlpr can find the process number and changing the "fax" command to "efax" was required because it attempted to create lock files which I didn't want it to create.
I believe my method of sending faxes also breaks the lock files, so it might screw up if you try to send a fax while it is receiving one.
After all this pain and suffering, your program that prints needs to be able to specify the "-J" option so that it can do a command like 'lpr -P fax -J "555 1212" file.ps'. Otherwise, print to a file and then print that file out with a line command.
Also, you could just use the efax command to send out a fax and not do it through the print service. You have to use gs to convert it before you send it out, which is still a pain.
Efax is only a temporary solution before I figure out how to get mgetty to work (which I tried to but failed). The only reason why I didn't use hylafax was because it clashed with mgetty when I tried to install the rpm and then I got interested in mgetty, and then diverted with efax. I am going to try and use mgetty in the future since I would like voice and login sessions as well with the same modem. It seems like it might be possible to use voice, login, and fax all on the same modem -- but it seems like there might be some problems with some modems to properly detect fax vs voice vs login. I really don't like sending out faxes with efax and the print service. I hope mgetty will solve some issues I had.
Article Version 1.2 : Date Last Changed Thu Jun 13 04:17:31 2002