[cups.general] waiting for printer to finish

Johannes Meixner jsmeix at suse.de
Tue Apr 26 06:53:17 PDT 2005


On Apr 26 08:02 bernd at rhm.de wrote (shortened):
> why does cups leave the printer in a state which is
> "Print file sent, waiting for printer to finish".
> This behavior came up the first time in SuSE 9.2 (Cups Version 1.21).
> Nothing goes wrong, the printer prints the next job
> although Cups thinks the job before isn't completed.

Isn't it perhaps only the last stderr message from a filter
or more likely from the backend (which backend do you use?)
which is not discarded by an empty stderr message?

Here a simple dumb example for a backend for /dev/lp0
which should do the notification correctly:
#! /bin/bash
# see the "CUPS Software Programmers Manual":
# "Writing Filters" and "Writing Backends"

# debug info in /var/log/cups/error_log
set -x

# output "Device Discovery" information on stdout
if [ "$#" -eq "0" ]
  echo 'direct lp0:/dev/lp0 "Unknown" "lp0 Printer"'
  exit 0

# have the input at fd0 (stdin) in any case
if [ -n "$6" ]
  exec <"$6"

# infinite retries to access the device
until cat /dev/null >/dev/lp0
  echo 'INFO: cannot access /dev/lp0 - retry in 30 seconds' 1>&2
  sleep 30
echo 'INFO: sending the data to /dev/lp0' 1>&2

# forward the data from stdin to the device
if cat - >/dev/lp0
  echo 'INFO:' 1>&2
  exit 0
  echo 'ERROR: failed to send the data to /dev/lp0' 1>&2
  exit 1

Note that the message before the "exit 1" is not discarded
because when the backend is disabled this message should stay.

But before the "exit 0" any previous messages is discarded
by an empty message.

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