logo       

Re: Re: Re: a question about filter diagnostics: msg#00018

printing.cups.devel

Subject: Re: Re: Re: a question about filter diagnostics

cem_han% at yahoo dot com wrote:
>
> Anonymous wrote:
> > Can you post the filter?
> >
> /var/log/cups$ cat /usr/lib/cups/filter/nullfilter
> #!/bin/sh
> echo "New print job: " $(date) >> $TMPDIR/nullfilter.log
> echo "Parameters: " $* >> $TMPDIR/nullfilter.log
> exit 0

OK -- your filter does not "behave" like a good CUPS filter should:


* if the filter is a *backend* and run with no arguments, it should
output a message like

'type name "Unknown" "Description"'

cupsd uses this at startup to query for available backends (which
are also listed by "lpinfo -v")


* all filters (including backends) should be able to read from stdin and
write to stdout


* all filters (including backends) should process 6 or 7 parameters in this
order (and output an error message if run with wrong number of arguments):
$0 - printer: name of target printer or name of filter itself
$1 - job: CUPS job ID of current print job
$2 - user: name of the user who prints this job
$3 - copies: number of copies requested by user
$4 - title: title for this job
$5 - options: print options for this job
[$6 - filename: filename to process, if input is not taken from stdin]


See also


http://www.linuxprinting.org/kpfeifle/SambaPrintHOWTO/Samba-HOWTO-Collection-3.0-PrintingChapter-9th-draft.html#14_7_3

for a description.

If you re-write your filter to read

#!/bin/sh
TMPDIR=/tmp
echo "ERROR: $0 job-id user title copies options [file]"
echo "New print job: $(date), title $3, printed by $2, assigned job ID is $1"
>> $TMPDIR/null1filter.log
echo "job ID $1 is asked to be printed with $4 copie(s), using print options:
$5" >> $TMPDIR/null1filter.log
echo "Parameters: " $* >> $TMPDIR/null1filter.log
exit 0


everything should be well-behaving and work (of course it needs to be
executable too)....

Cheers,
Kurt

P.S.: -- oh, and you didn't have your $TEMPDIR variable set.... (1st secret)
-- and your "filter" should even have been called even in the shape it
was in if it --a) were executable and --b) had the $TEMPDIR
defined [but it would be a badly behaving one...]


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise