[cups.general] Backend Proxy Shell Script

Pascal DeMilly list.cups at newgenesys.com
Tue Nov 2 21:52:59 PST 2004


First it looks that you are not using $6 in your script apart from
saving it in INPUT. If I understand correctly your script, the line

cat - >/tmp/printjob.out

should read

cat $INPUT >/tmp/printjob.out

I would remove the call to the backend from your script and do the
following. Let's say you call it myfilter.sh, create your printer as
follow

lpadmin -p myprinter -i myfilter.sh -v parallel:/dev/lp0 -E

Anything send to stdout from that script will be sent to the parallel
backend by CUPS

HTH

Pascal

On Fri, 2004-10-29 at 17:18, alex at j2anywhere.com wrote:
> I have the following shell script. When I print to the printer attached to that backend I experience problem I have tracked the problem down to the forwarding of my stdin stream into the parallel backend.
> 
> Could you please guide me how to forward the print job correctly to the parallel backend.
> 
> #!/bin/bash
> LOG=/tmp/cupsproxyfilter.log
> echo "=======================================================" >> $LOG
> date >> $LOG
> echo "=======================================================" >> $LOG
> echo "I am running under this user ID:" >> $LOG
> id >> $LOG
> echo "=======================================================" >> $LOG
> env >> $LOG
> 
> echo "TEMP FILES" >> $LOG
> ls -a /var/spool/cups/tmp/ >> $LOG
> echo PAGECOUNT : $PGCOUNT >> $LOG
> echo 0 $0 >> $LOG
> echo 1 $1 >> $LOG
> echo 2 $2 >> $LOG
> echo 3 $3 >> $LOG
> echo 4 $4 >> $LOG
> echo 5 $5 >> $LOG
> echo 6 $6 >> $LOG
> 
> # create a directory to store the output of each single filter
> # under a uniq name for later debugging purpose
> [ -d /tmp/cups-filter-outputs ] || mkdir /tmp/cups-filter-outputs
> 
> # in case of wrong number of arguments: print usage hint
> if test "$#" -eq "0"; then
> 	echo direct "\"Audited Parallel\" \"AUDITED Canon S400\" \"Audited Parallel Port\""
> 	exit 0
> fi
> 
> if test "$#" -lt "5"; then
> 	echo "ERROR: Number of arguments ($#) is wrong" 1>&2
> 	echo "USAGE: `basename $0` job-id user title copies options [file]" 1>&2
> 	exit 1
> fi
> 
> if test "$#" -gt "6"; then
> 	echo "ERROR: Number of arguments ($#) is wrong" 1>&2
> 	echo "USAGE: `basename $0` job-id user title copies options [file]" 1>&2
> 	exit 1
> fi
> 
> if test "$#" -eq "5"; then
> 	INPUT="-"
> else
> 	INPUT="$6"
> fi
> 
> echo "Complete invocation command" >> $LOG
> echo $0 "$@" >> $LOG
> echo "$#" >> $LOG
> echo `id` >> $LOG
> MESSAGE=`echo Print JOB $1 Submitted by : $2 with Title : $3`
> export DISPLAY=localhost:0
> /usr/X11R6/bin/xmessage $MESSAGE
> echo "Calling parallel" "$@" >> $LOG
> cat - > /tmp/printjob.out
> #cat /tmp/printjob.out | /usr/lib/cups/backend/parallel "$@"
> exec parallel "$@" < /tmp/printjob.out
> 
> _______________________________________________
> cups mailing list
> cups at easysw.com
> http://lists.easysw.com/mailman/listinfo/cups
-- 
Pascal DeMilly <list.cups at newgenesys.com>





More information about the cups mailing list