From kbs=cusm@shady.com Thu Apr 15 17:44:04 1999 Path: rQdQ!remarQ73!supernews.com!remarQ.com!newsfeed.direct.ca!newshub.northeast.verio.net!newsserver.jvnc.net!192.65.202.1!dsinc!nntp.upenn.edu!news.misty.com!shady!shady!not-for-mail From: kbs=cusm@shady.com (Kevin Smith) Newsgroups: comp.unix.sco.misc Subject: Re: On pooling of printers Date: 15 Apr 1999 20:44:04 -0400 Organization: ShadeTree Software, Inc. Lines: 183 Sender: kevin@shady.com Message-ID: <7f614k$p01@shady.shady.com> References: NNTP-Posting-Host: localhost.shady.com Xref: rQdQ comp.unix.sco.misc:86249 In article mansaxel@bartlet.df.lth.se (Måns Nilsson) writes: >As I have discovered, after much grief, SysV printing does not support printer >classes for BSD-style lpd print queues. Not on OpenSewer, and not on Slowaris. >The only solution as I see it now is to get an NT server to do the pooling and >print through it via lpd, which the customer naturally is a little bit worried >over, with NT reliability issues and the like. My question would then be this: > >Has anyone come up with a method to do printer classes using remote printers >under SCO? I am unable to do classes on another system, since the printers are >a mix of Jet Direct cards and Axis print servers. You can define all local printers that forward to the remote printers in the interface script then class them all you want. Generally I setup remote printers with the same name as the local printer but with a leading 'r'. The local printer interface just does ... | lp -dr$printer where $printer is determined from the script name (i.e. basename $0). I did an implementation that would wait for the remote printer queue to empty before forwarding the job. This would get you the right disbursment of jobs sent to a class. You could also use my netcat program (http://www.cruzio.com/~jeffl/sco/lp/) to address the jetdirects directly from a local printer interface script and I've recently started using axis's prossysv.c (modified to read stdin) to do the same (the rtelnet interface seems to not like direct output from netcat... probably need to negotiate some telnet options...). This is the interface to sit on the remote queue and forward jobs ------ stsnet ------ : # @(#)stsnet - model lp interface to forward to remote printer # @(#)STS/KBS Sep 25 1995 #! ShadeTree Software, Inc. Printer Interface Model # Look for remote printer (/etc/printcap) the same as our current # name but with an 'r' prefix. Wait for the remote print queue to # empty, then forward the current job to the remote printer PRINTCAP=/etc/printcap LOCALPATH=/usr/spool/lp/bin PATH=$PATH:$LOCALPATH:/usr/lib LPBASE=`basename $0` # get printer name from cmd # exit and cancelation special processing _cancel() { # cancel printing : } _exit() { # clean up before leaving : } _init() { # printer initialization : } _fail() { # Failed to forward request. Disable printer failmsg="$*" echo "$failmsg" >&2 disable -r "$failmsg" $LPBASE exit 1 } #Get remote printer queue RLP=r${LPBASE} [ ! -r $PRINTCAP ] && _fail "Cannot read $PRINTCAP" queue=` sed -n ' /^#/d /^[ ]*$/d /\\\/ { s/\\\/ /g H b } H g s/\n/ /g s/\(:..\):/\1=:/g s/\(:..\)#/\1=/g s/:/ /g s/^[ ]*/printer=/ p s/.*// h ' $PRINTCAP | while read line do eval "$line" # set variables from joined line [ x"$printer" = x$RLP ] && { echo "$sd" break } done ` [ x"$queue" = x ] && _fail "Cannot determine queue for remote printer $RLP" while : do break=yes for qf in $queue/cf* do [ -f $qf ] && { sleep 5 break=no break } done [ $break = yes ] && break done #Set up the default filter. if [ -x "${LOCALPATH}/lp.cat" ] then LPCAT="${LOCALPATH}/lp.cat 0" else LPCAT="cat" fi # trap exits and cancelations and perform special processing trap '_exit' 0 trap '_cancel;exit 0' 1 2 3 15 nhead=0 # set to 1 or more to enable banners printer=`basename $0` request=$1 name=$2 title=$3 copies=$4 options=$5 shift; shift; shift; shift; shift # If it is necessary to change the baud rate or other stty settings for # your serial printer add the appropriate options here: # stty onlcr time 30 <&1 # border around the banner x="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" # the fifth field of the /etc/passwd file is assigned to the variable user user=`sed -n "s/^$name:.*:.*:.*:\(.*\):.*:.*$/\1/p" /etc/passwd` { # initialize the printer _init # print the banner $nhead times while [ "$nhead" -gt 0 ] do echo "$x\n" banner "$name" echo "$x\n" [ "$user" ] && echo "User: $user\n" echo "Request id: $request\n" echo "Printer: $printer\n" date echo [ "$title" ] && banner $title echo "\f\c" nhead=`expr $nhead - 1` done n=1 while [ $n -le $copies ] do # send the file(s) to the standard out $copies times for file do 0<$file eval ${LPCAT} 2>&1 echo "\f\c" done n=`expr $n + 1` done } | lponlcr | lp -d${RLP} -s exit 0 -- Do two rights make | Kevin Smith, ShadeTree Software, Philadelpha, PA, USA a libertarian | 001-215-487-3811 shady.com,kevin bbs.cpcn.com,sysop