Recover from errors automatically

Kurt Pfeifle kpfeifle at danka.de
Tue May 10 15:21:19 PDT 2005


> > Since a few weeks I'm using CUPS to manage a couple of
> > printers. One of them, HP 2300, gives an error once per
> > week or so, which makes CUPS stop the cue and I have to
> > manually restart it.
> >
> > Usually the problem is solved by restarting the printer
> > which is something that the end user can do himself but
> > it won't work until CUPS is told to restart.
> >
> > Is there a way to tell CUPS to retry every few minutes if
> > there is an error?
>
> No, but you can set up a cron job and have it check
> periodically on status and restart if neccessary.
>
> Use this:
>
> #!/bin/sh
> for printer in `lpstat -p | grep 'disabled since' | awk '{print $2}'`; do
>     enable $printer
> done


Careful with a pure "enable" command on Linux! It is better to use the full path here:  f.e /usr/bin/enable

Reason: on Linux /bin/sh is a symlink to /bin/bash. But Bash contains a builtin command named "enable" which is a completely different cattle of fish....

Cheers,
Kurt






More information about the cups mailing list