[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lprng
Subject:    Re: LPRng: One Print Queue -> Multiple Network Printers
From:       christoph.beyer () desy ! de
Date:       2003-01-31 8:06:39
[Download RAW message or body]

Hi Patrick,

see the following configuration for a loadbalancing queue type of thing:

on the client:
[pcx1839] ~ $ ~lp/sbin/lpc printcap pubcp1
Printer: pubcp1@pcx1839
pubcp1|pubcp1d|2b_131_c
 :mx#0
 :rm=spoola,spoolb
 :rp=pubcp1
 :sd=/usr/spool/lp/request/pubcp1


on the server:

the incoming queue:
[printsrv2] ~lp/test $ lpc printcap pubcp1
Printer: pubcp1@printsrv2
pubcp1|pubcp1d
 :ab
 :chooser=/usr/spool/lpd/bin/check_idle
 :cm=Pha_7700 PS_2 4 A4 duplex paper, Operators, 5005,
paper/foil-automatic
 :du#16
 :lpd_force_poll
 :lpd_poll_time=60
 :max_status_size=1
 :mx#0
 :sv=pubcp1a,pubcp1b

the subqueues:
[printsrv2] ~lp/test $ lpc printcap pubcp1a
Printer: pubcp1a@printsrv2
pubcp1a
 :ab
 :bp=/usr/spool/filters/psbanner
 :du#16
 :filter=/usr/spool/filters/ifhp.loadbalance -Tletter2a4,duplex,a4,,noadjcolor
 :force_localhost
 :ifhp=model=phaser7700
 :lp=515@pubcp1a
 :lpd_bounce
 :lpd_force_poll
 :lpd_poll_time=60
 :max_status_size=1
 :mx#0
 :of=/usr/spool/ifhp/libexec/filters/ifhp
 :ss=pubcp1
 :translate_incoming_format=lf

The chooser script: is called by the lpd and returns the name of a
subqueue so you can do anything inside it from simple roundrobin to
whatever :-) One known bug to mention: Often the returned queue does not
get accepted and you end up with "blabla not a valid subserver" (works on
the second try then, so just a delay of a few seconds), I looked
in the source but wasn't clever enough :-(


[printsrv2] ~lp/test $ cat /usr/spool/lpd/bin/check_idle
#!/bin/sh
#script for loadbalancing, is called by lpd and checks if a named printer
is idle
#C. Beyer 11-00

#rm /tmp/check_log
#touch /tmp/check_log
#exec 2>>/tmp/check_log
#set -x

HOME="/usr/spool/lp"
HPNP="$HOME/bin/hpnp"
PING="/usr/sbin/ping"
PRN_OPT="$HOME/model/prn_options"
PATH="$HOME/bin:/bin:/usr/bin:/usr/local/bin"
PWD=`pwd`
QUEUE=`basename $PWD`
PRINTERS=`set | grep ":sv=" | awk -F= '{print $2}' | sed s/,/" "/g`
JOB=`set | grep "CONTROL" | awk -F= '{print $2}' | sed s/A//`

#for i in `/usr/spool/lp/sbin/lpc printcap $QUEUE`
#do
#echo $i | sed s/" "// | grep =
#done

if test -s .new.order.$QUEUE
then
NEWORDER=`cat .new.order.$QUEUE`
PRINTERS="$NEWORDER"
fi
for i in $PRINTERS
do
if test -x "$PRN_OPT/$i"
then
 . "$PRN_OPT/$i"
else
 echo "$i: Warning: Missing $PRN_OPT/$i" >> log
 exit 1
fi

case $PRN_NETHW in
        *HPip*)
                SNMPREQUEST="$HPNP $PRN_ADDR";;
        *TeK*)
                SNMPREQUEST="$HOME/bin/lpq -P9100@$PRN_ADDR";;
        *)
                echo "$i: unknown PRN_NETHW type: $PRN_NETHW" >> log;;
esac

if $PING $PRN_ADDR 1 > /dev/null
then
case `$SNMPREQUEST` in
        *": ready to print"* | *": no jobs queued"* | *"no entries"* |
*"toner/ink low"* | *"POWERSAVE EIN"* | *"Energy Star Mode active - Press
OK button "* | *"Phaser 7700DN Ready To Print."*)
                echo "$i"
                rm .new.order.$QUEUE
                NEWORDER="`echo $PRINTERS | sed s/$i//` $i"
                echo "$NEWORDER" > .new.order.$QUEUE
                echo "`date` $JOB forwarded to $i" >> log
#               echo "NEWORDER = $NEWORDER" >> log
                exit 0;;
        *)
                ;;
esac
fi
done



best regards
	~christoph


-- 
/*   Christoph Beyer     |   Office: Building 2b / 23     *\
 *   DESY                |    Phone: 040-8998-2317        *
 *   - IT -              |      Fax: 040-8998-4060        *
\*   22603 Hamburg       |     http://www.desy.de         */


On Thu, 30 Jan 2003 sweitzer@softhome.net wrote:

> Does anyone know how I might go about setting up one print queue to use
> multiple network printers??  I have one queue/printer working on this
> machine at the moment and the person I am building the print server for
> wants to still only have one print queue but have the queue use 3 or 4
> printers.  They want it so that if printer one is busy printer two will take
> the job and print it....   and so on....
>
> Any help would be appreciated...
>
> Probably a good idea to mention the print server is a Redhat 7.2 machine
> running LPRng-3.7.4-28.1!
>
>
> Patrick
>
> sweitzer@softhome.net
>
> Everyone has a photographic memory, some people just don't have film!
>
> -----------------------------------------------------------------------------
> YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LIST
> The address you post from MUST be your subscription address
>
> If you need help, send email to majordomo@lprng.com (or lprng-requests
> or lprng-digest-requests) with the word 'help' in the body.  For the impatient,
> to subscribe to a list with name LIST,  send mail to majordomo@lprng.com
> with:                           | example:
> subscribe LIST <mailaddr>       |  subscribe lprng-digest myname@host.org
> unsubscribe LIST <mailaddr>     |  unsubscribe lprng myname@host.org
>
> If you have major problems,  send email to papowell@astart.com with the word
> LPRNGLIST in the SUBJECT line.
> -----------------------------------------------------------------------------
>


-----------------------------------------------------------------------------
YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LIST
The address you post from MUST be your subscription address

If you need help, send email to majordomo@lprng.com (or lprng-requests
or lprng-digest-requests) with the word 'help' in the body.  For the impatient,
to subscribe to a list with name LIST,  send mail to majordomo@lprng.com
with:                           | example:
subscribe LIST <mailaddr>       |  subscribe lprng-digest myname@host.org
unsubscribe LIST <mailaddr>     |  unsubscribe lprng myname@host.org

If you have major problems,  send email to papowell@astart.com with the word
LPRNGLIST in the SUBJECT line.
-----------------------------------------------------------------------------
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic