On Sun, 1 Sep 2019 14:19:58 +0200 hw wrote:
Yet if a printer doesn't print anymore, it is desirable to divert jobs to another printer, preferably a designated fallback. It is of no use when the jobs get stuck in the queue until the printer is being maintained which can be days later.
You might want to write a program that will check the printer queues on a regular basis and re-route the job if the printing stops.
lpstat will tell you what's going on with the printer (check queue, is it online, etc)
I don't know if there's an "official" way to recover a print job (you can research this yourself), but they are stored in /var/spool/cups so you could pull them directly from there if needed.
A bit of glue code to link all of that together (check printer status every X minutes, if the next pending job from the last check is still not printing then recover all of the incomplete jobs, cancel the printing on the local printer, re-route the recovered jobs to a different printer) and you'll be all set.