[cups.general] Re: Slow down queue

Johannes Meixner jsmeix at suse.de
Tue Jan 3 02:01:39 PST 2006


Hello,

On Jan 3 01:19 Greg Jones wrote (shortened):
> > I have a serial label printer connected to a Stallion EasyServerII.
> > The EasyServer is listening for connections and passes the job
> > to the serial port.
> > My problem is that jobs in quick succession get lost.
....
> > .. how can I force cups to only send 1 jobs to it at a time.
> > Looking at the output of the netstat command it seems like all
> > jobs have gone to the printserver at once!!
....
> The printer is setup as a socket, raw printer.

For one print queue the cupsd processes only one job at the
same time (this is the main purpose of a queue: serialize
multiple requests).

Obviously the firmware in the printserver box is broken
because it accepts new jobs even if it cannot process them.

As workaround use a selfmade backend where you can add
a delay.
Here a very simple backend with everything hardcoded:
---------------------------------------------------------------------
#! /bin/bash
# see the "CUPS Software Programmers Manual":
# "Writing Filters" and "Writing Backends"
# and see the man page "man backend".

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

# output "Device Discovery" information on stdout
if [ "$#" -eq "0" ]
then
  echo 'network DumbSocket://192.168.1.2:9100 "Unknown" "Dumb Socket"'
  exit 0
fi
  
# have the input at fd0 (stdin) in any case  
if [ -n "$6" ]
then
  exec <"$6"
fi

# infinite retries to access the remote port
until netcat -z 192.168.1.2 9100
do
  echo 'WARNING: no access - retry in 30 seconds' 1>&2
  sleep 30
done
echo 'INFO: sending the data' 1>&2
  
# forward the data from stdin to the remote port
if netcat -w 1 192.168.1.2 9100
then
  echo 'INFO: 10 seconds delay to let it process the data' 1>&2
  sleep 10
  echo 'INFO:' 1>&2
  exit 0
else
  echo 'ERROR: failed to send the data' 1>&2
  exit 1
fi
---------------------------------------------------------------------
Replace the hardcoded "192.168.1.2" with the correct IP
and "9100" with the correct port of your printserver box
or enhance it a bit so that you can specify IP and port
in the DeviceURI string.
Save it as /usr/lib/cups/backend/DumbSocket
Set read and execute permissions accordingly.
Restart the cupsd.
Verify that the new backend is shown in "lpinfo -v".
Change the DeviceURI of the queue using
lpadmin -p <queue> -v DumbSocket://192.168.1.2:9100


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