4

We have a Redhat machine (2.6.9-42.ELsmp) that runs CUPS. Once in a while, people send big files to the printer, and it gets stuck, so they restart the printer. After 300 seconds of it not responding, the printer becomes UNavailable. CUPS will then remove the printer from the available printer list, and never tries it again.

Is there anyway I can set it so that CUPS will try to talk to the printer to re-add it to the list whenever the printer is online again?

The way we "solve" this is every time it happens, we manually modify the printers.conf file, change the printer status to "Idle", then restart the service. I'm sure there's a better to do this, no?

Thanks,

Tam.

3 Answers3

3

This should be fixed by changing the ErrorPolicy in cupsd.conf or printers.conf:

CUPS 1.3/Mac OS X 10.5ErrorPolicy

Examples

ErrorPolicy abort-job

ErrorPolicy retry-job

ErrorPolicy stop-printer

Description

The ErrorPolicy directive defines the default policy that is used when a backend is unable to send a print job to the printer. [...]

See: http://www.cups.org/doc-1.4/ref-cupsd-conf.html#ErrorPolicy

The default is:

stop-printer - Stop the printer and keep the job for future printing

however you probably want:

retry-job - Retry the job after waiting for N seconds [...]

(or maybe retry-this-job).

Note: On CUPS V1.4+ it's called FatalErrors.

sleske
  • 9,851
  • 4
  • 33
  • 44
1

Your problem could be tackled in different ways, depending on the version of CUPS you're running.

Also, it depends on how exactly the CUPS server print queue connects to the real print device: ipp://?, socket://?, lpd://?

More recent versions of CUPS come with a builtin functionality that could help here. It's called "ErrorPolicy". It's default setting is selected in cupsd.conf, and determines how cupsd should handle print queues which do not behave as expected. You have 4 choices to set as default or to tag to each queue individually:

ErrorPolicy abort-job  
ErrorPolicy retry-job  
ErrorPolicy retry-this-job  
ErrorPolicy stop-printer  
abort-job
-- Abort this job and proceed with next job in same queue
retry-job
-- Retry this job after waiting for N seconds (where N is determined by cupsd.conf's "JobRetryInterval" directive).
retry-this-job
-- Retry current job immediately and indefinitely.
stop-printer
-- Stop current print queue and keep the job for future printing. This is still the default, unless you define otherwise as per above mentioned alternatives It also was default + only possible behaviour for all queues in previous versions of CUPS (the one you do want to get rid of as per your question).

Additionally, you can set individual ErrorPolicies to each separate print queue. This setting would be noted in the printers.conf file. (Set it from a commandline with lpadmin -p printername -o printer-error-policy=retry-this-job).


For older versions of CUPS I'd recommend to have a look at beh, the CUPS BackEnd Handler. beh is a wrapper which can be applied to any CUPS backend.

Assuming your print queue currently has defined a backend of socket://192.168.1.111:9100, and it behaves in the way you don't like (being disabled by cupsd from time to time due to network connection problems). With beh you'd re-define your backend like this:

beh:/0/20/120/socket://192.168.1.111:9100

This would retry a job 20 times in two minute intervals, and disable the queue only when still not succeeding. Or you could do this:

beh:/1/3/5/socket://192.168.1.111:9100

This retries the job 3 times with 5 second delays between the attempts. If the job still fails, it is discarded, but the queue is not disabled. You want to let cupsd try indefinitely to connect to the device? Good, try this:

beh:/1/0/30/socket://192.168.1.111:9100

Try infinitely until printer comes back. Intervals between connection attempts are 30 seconds. The job does not get lost when the printer is turned off. You can intentionally delay printing simply by switching off the printer. A good configuration for desktop printers and/or home users.


Overall, there is no need to mess around with bash scripts, cron jobs, lpadmin, cupsenable or sudo in order to re-activate CUPS queues going down erratically.

Kurt Pfeifle
  • 1,746
  • 2
  • 12
  • 19
0

You could simply use the "enable " command as root (or some other cups administrator account). If it happens really too often, add a small crontab using "lpstat -a" to find out disabled printers.

wazoox
  • 6,782
  • 4
  • 30
  • 62