[cups.general] backend script

Johannes Meixner jsmeix at suse.de
Thu Jan 26 01:35:40 PST 2006


Hello,

On Jan 25 17:23 Jim wrote (shortened):
> Trying to lean backend.

Did you mean "learn"?

> Here is what I have so far:
> ---------
> #!/bin/sh
> 
> job=
> 
> lp -d printer-01 $job
> lp -d printer-02 $job
> lp -d printer-03 $job
> 
> exit 0
> ---------
> 
> Trying to send on print job to three printers.
> How would i set $job ?

A backend or a filter gets its input via stdin or via file
if the optional 6th parameter is specified.

You would have to store the input in a temporary file and
then send this temporary file to the other queues, like
--------------------------------------------------------
# have the input at fd0 (stdin) in any case
[ -n "$6" ] && exec <"$6"

# have the input as regular file
MY_NAME=${0##*/}
INPUT=$( mktemp /var/spool/cups/tmp/$MY_NAME.XXXXXX )
cat - >$INPUT

# send it to the other queues
for QUEUE in printer-01 printer-02 printer-03
do lp -d $QUEUE $INPUT
done

# remove the temporary file
rm $INPUT
exit 0
--------------------------------------------------------

For details see the "CUPS Software Programmers Manual":
"Writing Filters" and "Writing Backends"
and see the man pages "man backend" and "man filter".


Kind Regards
Johannes Meixner
-- 
SUSE LINUX Products GmbH, Maxfeldstrasse 5      Mail: jsmeix at suse.de
90409 Nuernberg, Germany                    WWW: http://www.suse.de/





More information about the cups mailing list