articles:cupsprinting
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
articles:cupsprinting [2009/02/16 12:13] – timallen | articles:cupsprinting [2010/02/08 08:54] (current) – timallen | ||
---|---|---|---|
Line 150: | Line 150: | ||
===== Putting It All Together ===== | ===== Putting It All Together ===== | ||
+ | |||
==== Sambafax ==== | ==== Sambafax ==== | ||
- | Sambafax uses Hylafax to send a document to a recipient, based on a fax number embedded in a Postscript document. Sambafax was originally written by Ignace Suy. {{articles: | + | Sambafax uses Hylafax to send a document to a recipient, based on a fax number embedded in a Postscript document. Sambafax was originally written by Ignace Suy. The modified version |
+ | |||
+ | < | ||
+ | #!/bin/sh | ||
+ | # | ||
+ | # Faxing with HylaFax through a faxprinter | ||
+ | # Heavily modified from original version. Supports CUPS and LPR | ||
+ | # | ||
+ | # $Id: sambafax,v 1.9 2009-06-30 08:43:41 tda Exp $ | ||
+ | |||
+ | |||
+ | # Printer spool type (LPR or CUPS) | ||
+ | PRINTSYSTEM=" | ||
+ | |||
+ | # Constants | ||
+ | SENDMAIL="/ | ||
+ | |||
+ | # Make up a temporary file using PID | ||
+ | FAXFILE=/ | ||
+ | |||
+ | # Fax number format | ||
+ | # Match FAX : '01234 567890' | ||
+ | # Deals with newlines in string and 0xad as hyphen | ||
+ | PARSE=" | ||
+ | b testfirst | ||
+ | : appendnext | ||
+ | N | ||
+ | y/ | ||
+ | : testfirst | ||
+ | s/.*fax *: *' | ||
+ | T appendnext | ||
+ | s/[ -]//g | ||
+ | p | ||
+ | q | ||
+ | " | ||
+ | |||
+ | # Retrieve the username and hostname from the parameters | ||
+ | if [ $PRINTSYSTEM = " | ||
+ | while : | ||
+ | do | ||
+ | case " | ||
+ | -n) Username=" | ||
+ | shift ; shift | ||
+ | ;; | ||
+ | -h) Hostname=" | ||
+ | shift ; shift | ||
+ | ;; | ||
+ | -*) shift | ||
+ | ;; | ||
+ | *) break | ||
+ | esac | ||
+ | done | ||
+ | cat > | ||
+ | else | ||
+ | # CUPS | ||
+ | Username=" | ||
+ | cat " | ||
+ | fi | ||
+ | |||
+ | # If the samba user is anonymous then send mails to the postmaster | ||
+ | if [ " | ||
+ | MailTo=" | ||
+ | else | ||
+ | MailTo=" | ||
+ | fi | ||
+ | |||
+ | # Retrieve the faxnumber from the printfile | ||
+ | FAXNUM=`pstotext ${FAXFILE} | sed -n " | ||
+ | |||
+ | # If faxnumber is found fax the tempfile | ||
+ | # We do not check the validity of the faxnumber, let sendfax do this... | ||
+ | if [ " | ||
+ | (echo "To: ${MailTo}" | ||
+ | echo "From: The HylaFAX Samba print service < | ||
+ | echo " | ||
+ | echo "" | ||
+ | echo -n "The faxnumber is not recognized in your fax of " | ||
+ | echo -n `date` | ||
+ | echo " | ||
+ | echo "The faxnumber is recognised by this text:" | ||
+ | echo "" | ||
+ | echo " | ||
+ | echo "" | ||
+ | echo "Only spaces, ',' | ||
+ | echo "" | ||
+ | echo " | ||
+ | ) | 2>&1 $SENDMAIL -ffax -oi ${MailTo} | ||
+ | else | ||
+ | sendfax -n -D -m -f ${MailTo} -d ${FAXNUM} ${FAXFILE} | ||
+ | fi | ||
+ | |||
+ | # Remove the temp file | ||
+ | # rm -f ${FAXFILE} | ||
+ | |||
+ | # End of file | ||
+ | </ | ||
+ | |||
First, copy the sambafax script to ''/ | First, copy the sambafax script to ''/ |
articles/cupsprinting.1234786437.txt.gz · Last modified: 2009/02/16 12:13 by timallen