HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [hylafax-users] print out received fax automatically



Siew Wing Loon wrote:
> 
> Hi,
> 
> How can I set hylafax to print out received fax automatically?

see $HYLAFAX/faxrcvd and man faxrcvd

following is a much-shortened faxrcvd that just prints received faxes and e-mail notifications of failures.

=========================================================
#! /bin/sh
#       $Id: faxrcvd.sh.in,v 1.3 2002/02/15 04:31:04 darren Exp $
#
# HylaFAX Facsimile Software
#
# Copyright (c) 1990-1996 Sam Leffler
# Copyright (c) 1991-1996 Silicon Graphics, Inc.
# HylaFAX is a trademark of Silicon Graphics
# 
# Permission to use, etc...

#
# faxrcvd file devID commID error-msg
#
if [ $# != 6 ]; then
    echo "Usage: $0 file devID commID error-msg CIDNumber CIDName "
    exit 1
fi

test -f etc/setup.cache || {
    SPOOL=`pwd`
    cat<<EOF

FATAL ERROR: $SPOOL/etc/setup.cache is missing!

The file $SPOOL/etc/setup.cache is not present.  This
probably means the machine has not been setup using the faxsetup(8C)
command.  Read the documentation on setting up HylaFAX before you
startup a server system.

EOF
    exit 1
}
. etc/setup.cache

INFO=$SBIN/faxinfo
FAX2PS=$TIFFBIN/fax2ps
MIMENCODE=mimencode
TIFF2PS=tiff2ps
PS2PDF=ps2pdf
TOADDR=FaxMaster

#
# Permit various types of attachment types: ps, tif, pdf
# Note that non-ASCII filetypes require metamail.
# pdf requires tiff2ps and ps2pdf
#
FILETYPE=ps

#
# There is no good portable way to find out the fully qualified
# domain name (FQDN) of the host or the TCP port for the hylafax
# service so we fudge here.  Folks may want to tailor this to
# their needs; e.g. add a domain or use localhost so the loopback
# interface is used.
#
HOSTNAME=`hostname`                     # XXX no good way to find FQDN
PORT=4559                               # XXX no good way to lookup service

FILE="$1"
DEVICE="$2"
COMMID="$3"
MSG="$4"
CIDNUMBER="$5"
CIDNAME="$6"

FILENAME=`echo $FILE | $SED -e 's/\.tif//' -e 's/recvq\///'`

if [ -f $FILE ]; then
    $FAX2PS -S -H 10.625 -W 8.21 $FILE | lpr 2>/dev/null
else
    #
    # Generate notification mail for a failed attempt.
    #
    (echo "To: $TOADDR"
     echo "From: The HylaFAX Receive Agent <fax>"
     echo "Subject: facsimile not received"
     echo ""
     echo "An attempt to receive facsimile on $DEVICE failed because:"
     echo ""
     echo "    $MSG"
     echo ""
     echo "    ---- Transcript of session follows ----"
     echo ""
     if [ -f log/c$COMMID ]; then
        $SED -e '/-- data/d' \
             -e '/start.*timer/d' -e '/stop.*timer/d' \
            log/c$COMMID
     elif [ -n "$COMMID" ]; then
        echo "    No transcript available (CommID c$COMMID)."
     else
        echo "    No transcript available."
     fi
    ) | 2>&1 $SENDMAIL -ffax -oi $TOADDR
fi


-- 
Derek Shaw
Victoria, BC.
email address is a bit-bucket. Substitute derekshaw for he.is

____________________ HylaFAX(tm) Users Mailing List _______________________
  To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
 On UNIX: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null




Project hosted by iFAX Solutions