Redirection in CUPS?
Anonymous
anonymous at easysw.com
Thu Jul 28 06:22:00 PDT 2005
> Philipp Letschert wrote:
> > Hi,
> >
> > is there a function in CUPS that is similar to "lpc redirect"? We are
> > using CUPS and have a number of printers here with lots of jobs.
> > Sometimes a printer has a failure and all jobs in its queue should be
> > redirected to another printer.
>
> As Jerome pointed out, "lpmove" will move any currently queued jobs.
> However, it might be useful to support a "temporary redirect" of
> all jobs submitted to a printer - if you'd like to see this
> functionality, please file a request at:
>
> http://www.cups.org/str.php
Thanks for your help!
I have not filed a feature request, because 'your hint to lpmove was OK for me. I have written a small script to have the functionality I was looking for. Perhaps it is useful for others as well.
Cheers, Phil
---snip---
#!/bin/bash
#
# 050728 Philipp Letschert <let at shd.de>
#
#
desc="Moves all pending jobs from one printer to another printer."
usage="$desc\nUsage: lpredirect.sh <old printer> <new printer>\n\n"
reject=/usr/sbin/reject
accept=/usr/sbin/accept
disable=/usr/bin/disable
enable=/usr/bin/enable
lpstat=/usr/bin/lpstat
lpmove=/usr/sbin/lpmove
if [ $# != 2 ]; then
echo -ne $usage
exit 1
fi
old=$1
new=$2
# Before redirecting jobs, stop the printer
$reject $old || echo "couldn't stop printer: $old"
# Test if new printer is ready for accepting jobs
$accept $new || echo "printer does not exist: $new"
# move jobs
for job in `lpstat $old | awk '{print $1}'`; do
echo $job
$lpmove $job $new || echo "error moving job: $job"
done
echo -ne "\nAll jobs from $old successfully moved to $new.\n\n"
echo "Printer $old is now rejecting jobs."
echo -ne "To activate the printer again, use the following command:\n\n"
echo -ne "$accept $old\n\n"
exit 0
#EOF
More information about the cups
mailing list