Issue with CUPS filter script
We are moving an application from HP-UX to Red Hat 5 and I am having an issue with CUPS. A text file gets sent to the Linux system from the mainframe using CA-SPOOL to a print queue on the Linux system. On the HP-UX system when you create a printer it always creates and interface file in /var/spool/lp/interface for that print queue. This particular queue was defined on the HP-UX system as a generic network printer. We modified the interface script to run the file through a perl program to convert it to a postscript file and then it prints to that printer. On the Linux system I had to create a normal network printer call ISGprt and then I created another queue using lpadmin -p ISGPRN -v ipp://10.0.0.40/printers/ISGprt -i /tmp/ISGPRN where /tmp/ISGPRN was the scripted file used to convert the file to postscript. On the HP system it would run the perl script to convert the originally queued file to postscript and direct the output to a temp file and then move the temp file back to spool directory /var/spool/lp/requests/printername. On linux the spooled file is in /var/spool/cups and I can runt the perl script against it and output to temp file but it will not let me copy the temp file back to the spool directoy to overwrite the original spooled file. I tried to cat the temp file instead of the spooled file but it does not interpret the postscript language and just prints it as a text file. Belowis the content of the filter script ISGPRN. Any ideas on how to fix this would be greatly appreciated. I was able to copy the input file and run it through the perl script manually and then to a lp -d ISGPRN /tmp/perlfile, where ISGPRN was just a basic script seen below as ISGPRN.basic, and it print the document with all the postscript interpreted.
ISGPRN.basic
#! /bin/sh
# Command line arguments
job="$1"
user="$2"
title="$3"
numcopies="$4"
options="$5"
filename="$6"
# Pass through
cat "$filename"
__________________________________________________________________
ISGPRN.orig
#! /bin/bash
# Command line arguments
job="$1"
user="$2"
title="$3"
numcopies="$4"
options="$5"
filename="$6"
#Schnucks Modifications JAJ
echo "File to print="$filename >> /tmp/PAYROLL.log
# The following puts out a null file when the bogus 5 line file is generated
# from ca/spool
od -x $filename | grep "0000010 0a0d 0a0d 0a20 0d0a 0d0a 0d0a 200d 0c00"
XDRC=$?
echo "XDRC="$XDRC >> /tmp/PAYROLL.log
if [ $XDRC -eq 0 ]
then
cat zyxw > /tmp/dummy_check
mv /tmp/dummy_check $filename
fi
# The following is the pattern from z/OS and the new mainframe-Jan,2008"
od -x $filename | grep "0000010 0d0a 0d0a 0d0a 0d0a 0d0c"
XDRC=$?
echo "XDRC="$XDRC >> /tmp/PAYROLL.log
if [ $XDRC -eq 0 ]
then
cat zyxw > /tmp/dummy_check
mv /tmp/dummy_check $filename
fi
grep "[0-9]\{2\}/[0-9]\{2\}/[0-9]\{6\}/[0-9]\{2\}/[0-9]\{4\}" $filename
if [ $? -eq 0 ]
then
sed "s/./ &/1" $filename > $filename.tmp1
export RPINPATH=$filename.tmp1
export RPOTPATH=$filename.tmp2
export SIGPATH="/usr/emc/utilities/SIGTODD.DAT"
export MICRPATH="/usr/emc/utilities/IDAutomationSMICR.PFA"
export PRNTSITE="ISGPRN"
/usr/local/applications/bin/pyprtchk.pl --micr $MICRPATH --sig $SIGPATH --printer $PRNTSITE $RPINPATH > $RPOTPATH 2>> /tmp/PAYROLL.log
mv $filename.tmp2 $filename
rm $filename.tmp1
fi
#End Schnucks Mod
# Pass through
cat "$filename"