For When You Can't Have The Real Thing
[ start | index | login ]
start > RedHat > Enterprise > 4 > CUPS keeps dying

CUPS keeps dying

Created by dave. Last edited by dave, 8 years and 174 days ago. Viewed 4,734 times. #2
[diff] [history] [edit] [rdf]
labels
attachments

Problem:

I noticed this strange problem on an RHEL 4 server which has a vanilla CUPS setup. Once in a while, I come to work and lots of users are already mad at me because the queues are long, nothing is printing, and lpq says "printer not ready". I power-cycle the printer, start /usr/bin/enable, and everything works again.

It seems like CUPS shuts down printing on a queue when one of the file encounters a problem (which is very common with our older HP4000 printers). When we used LPRng, it would keep sending a file 3 times, and then give up. When this happened, users could power-cycle the printer to bring it back to life and then send the job again.

Half-Assed Solution:

In the end I took a more brute force approach. I added a simple, one line script to cron which checks for disabled printers every two minutes and enables any that it finds. It's crude, but actually quite effective. Credit for the script goes to someone on the CUPS forum.

/usr/sbin/lpc status | grep -B4 "printing is disabled" | grep : | tr -d ":" | xargs --max-args=1 /usr/bin/enable

Three-Quarters-Assed Solution:

  • checks for cupsd running and tries to restart it if it isn't
  • logs and bails if the restart attempt fails
  • logs the printers to be "enable"d
#!/bin/bash

CUPSPID=`pgrep cupsd` if [ -z "$CUPSPID" ] ; then service cups restart 2>&1 > /dev/null CUPSPID=`pgrep cupsd` if [ -z "$CUPSPID" ] ; then logger -t cups-watch failed to restart CUPS exit 1 fi fi /usr/sbin/lpc status | grep -B4 "printing is disabled" | grep : | tr -d ":" | xargs --max-args=1 logger -t cups-watch enable /usr/sbin/lpc status | grep -B4 "printing is disabled" | grep : | tr -d ":" | xargs --max-args=1 /usr/bin/enable

no comments | post comment
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful:


snipsnap.org | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt