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] as400script



Hi,
> How are you sending the file from the AS/400? In
> ASCII?
> What kind of error are you getting? What are the file
> permissions, logo eps file and as400script?
>

I set up a test queue in the as400 using as printer a ibm2381
I setted the permision to as400script and logo in chmod 777
I created the follow eps file:
/var/spool/lpd/filters/cristal.eps

and I'm using this script, I've noted that it does not create any file in
the tmp folder:

#!/bin/sh

cat - > /tmp/as.$$

Username="$1"

FILE_AS400=/tmp/as1.$$
FILE_T=/tmp/as2.$$
FILE_PS=/tmp/ps.$$

SENDMAIL="/usr/sbin/sendmail"
#TIFFBIN="/usr/bin"                |
#MIMENCODE=/usr/bin/mimencode    |
#PS2PDF=$TIFFBIN/ps2pdf <-------- For email notifications with the file,in
PDF format
#                                          |attached.

# At the beginning I thought that will be important to check if thefile
exists,
# but I realise that the file will never fail. But the line remains here, if
later
# proves to be necessary.
#
#if [ -s /tmp/as.$$ ] ; then

#Here is where we merge the text from AS400 with the company logo,
#stored in a file in ENCAPSULATED POSTSCRIPT format. Pay attention,
#in EPS format! This is very important to work correctly.
#Some tricks are made to work here so, if not work for you just
#ask. Thanks goes for Giulio Orsero for is asistance.

    LANG=en_US col -b  < /tmp/as.$$ > $FILE_AS400

    echo -e "\000epsf[x0ca y0ca nx ny ]{COMPANYLOGO.eps}" > $FILE_T

[root@hylafax filters]# find / -name *.eps
/var/spool/lpd/filters/cristal.eps

You have new mail in /var/spool/mail/root
[root@hylafax filters]# vi as400script

#!/bin/sh

cat - > /tmp/as.$$

Username="$1"

FILE_AS400=/tmp/as1.$$
FILE_T=/tmp/as2.$$
FILE_PS=/tmp/ps.$$

SENDMAIL="/usr/sbin/sendmail"
TIFFBIN="/usr/bin"                 |
MIMENCODE=/usr/bin/mimencode    |
PS2PDF=$TIFFBIN/ps2pdf <-------- For email notifications with the file,in
PDF format
#                                          |attached.

# At the beginning I thought that will be important to check if thefile
exists,
# but I realise that the file will never fail. But the line remains here, if
later
# proves to be necessary.
#
#if [ -s /tmp/as.$$ ] ; then

#Here is where we merge the text from AS400 with the company logo,
#stored in a file in ENCAPSULATED POSTSCRIPT format. Pay attention,
#in EPS format! This is very important to work correctly.
#Some tricks are made to work here so, if not work for you just
#ask. Thanks goes for Giulio Orsero for is asistance.

    LANG=en_US col -b  < /tmp/as.$$ > $FILE_AS400

    echo -e "\000epsf[x0ca y0ca nx ny ]{COMPANYLOGO.eps}" > $FILE_T

    cat $FILE_AS400 >> $FILE_T

    /usr/bin/enscript -B -e  $FILE_T -p $FILE_PS

#Our users login in AS400 are in uppercase and to not duplicate
#entrys I change them to lowercase

    UNAME=`echo "$Username" | sed -ne '/'-A'/{s/^.*'-A'//g;s/@.*//g;p;q;}' |
sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`

#Fax number extracted from the text. The text should have an entry
#like Fax : 1234567, not Fax: 1234567 or similar.

    FAXNUMBER=`sed -ne '/'Fax'/{s/^.*'Fax' :
*//g;s/[()]//g;s/[^0-9]\{1,\}.*^M$//g;p;q;}'` < /tmp/as.$$

if [ "$FAXNUMBER" = "" ] ; then

        (MIMEBOUNDARY="NextPart$$"
     echo "Mime-Version: 1.0"
     echo "Content-Type: Multipart/Mixed; Boundary=\"$MIMEBOUNDARY\""
     echo "Content-Transfer-Encoding: 7bit"
     echo "To: $UNAME@yourhost"
     echo "From: Fax Server<fax>"
     echo "Subject: Outgoing fax job failure"
     echo ""
     echo "--$MIMEBOUNDARY";
     echo ""
     echo "You request could not be completed!"
     echo `date`
     echo ""
     echo ""
     echo "Please, check if the fax number is missing openning the file
attached."
     echo ""
     echo "--$MIMEBOUNDARY";
     echo "Content-Type: application/postscript; name=$FNAME";
     echo "Content-Description: FAX document;";
     echo "Content-Disposition: inline;";
     echo "Content-Transfer-Encoding: 7bit";
     echo "";
     cat $FILE_PS
     echo "";
     echo "--$MIMEBOUNDARY--";
     echo "";
   ) | 2>&1 $SENDMAIL -ffax -oi $UNAME@yourhost

else

        sendfax -n -D -f $UNAME@yourhost -d $FAXNUMBER $FILE_PS

fi

#rm -f /tmp/as.$$ $FILE_AS400 $FILE_T $FILE_PS



____________________ 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@xxxxxxxxxxx < /dev/null
  *To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxxxxx*




Project hosted by iFAX Solutions