> From [EMAIL PROTECTED] Fri Sep 27 09:15:16 2002
> From: "Rodrigo Bindes \(E-mail\)" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Subject: Help with LPRng
> Date: Fri, 27 Sep 2002 11:12:26 -0500
>
> Hi!
>
> I saw your LPRng Web Page and liked it very much...
>
> I got a little problem here and you might be able to help me.
>
> One of my applications runs under Linux Red Hat 6.2 and it's accessed by a
> few users using telnet (tera term). This Linux box has only one printer
> connected to the Paralel interface and it's the only printer that we have
> for the whole building to print reports out of this application on Linux. We
> also have several networked printers (using TCP/IP) in our building and I
> was wondering how I could better use these printers.
>
> What I need is something like this:
>
> If a user using IP 192.168.1.X tries to print, use printer 192.168.1.111
> If a user using IP 192.168.2.X tries to print, use printer 192.168.2.222
>
> It can be also like this:
>
> Group X, prints on printer X (IP 192.168.1.111)
> Group Y, prints on printer Y (IP 192.168.2.222)
>
> The application won't let me do this...
>
> Do you have any solution for this. I am sure there is a way to do it, I just
> don't know how...
>
> I hope you can help me. Thanks in advance,
>
> Rodrigo Bindes
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.391 / Virus Database: 222 - Release Date: 9/19/2002


You need to determine the queue to use based on the originating
host address.

.common:lp=/var/spool/lpd:
lp:tc=.common:chooser=/usr/lib/libexec/chooser:
  :sv=lp1,lp2

lp1:tc=.common:[EMAIL PROTECTED]
lp2:tc=.common:[EMAIL PROTECTED]

Chooser:

 Here is a simple test version you can use:

#!/bin/sh
echo CHOOSER $0 "$@" 1>&2
echo PRINTERS $PRINTERS 1>&2
sed -e 's/,.*//'
exit 0

The output looks like:

Printer: [EMAIL PROTECTED] (subservers t5, t6)
 Queue: no printable jobs in queue
 Server: no server active
 Status: CHOOSER: CHOOSER /var/tmp/LPD/chooser [EMAIL PROTECTED] -CA 
-D2004-03-11-16:38:48.596 -Hh110.private -J/tmp/hi -Lpapowell -Pt4 -Qt4 -aacct -b3 
-d/var/tmp/LPD/t4 -hh110.private -j358 -kcfA358h110.private -l66 -npapowell -pt4 
-rlocalhost -sstatus -t2004-03-11-16:39:20.062 -w80 -x0 -y0 acct at 16:39:20.069
 Status: CHOOSER: PRINTERS t5,t6 at 16:39:20.069
 Status: Filter_file: pgm '/var/tmp/LPD/chooser' exited with status 'JSUCC' at 
16:39:20.072
 Status: CHOOSER selected 't5' at 16:39:20.072
 Status: moving '[EMAIL PROTECTED]' to subserver 't5' at 16:39:20.075
 Status: [EMAIL PROTECTED]: job '[EMAIL PROTECTED]' printed at 16:39:20.143
 Status: job '[EMAIL PROTECTED]' saved at 16:39:20.146
 Status: transfer '[EMAIL PROTECTED]' to queue 't5' finished at 16:39:20.147
 Status: starting subserver 't5' at 16:39:20.147
 Status: waiting for server queue process to exit at 16:39:20.165
 Status: no more jobs to process in load balance queue at 16:39:20.221

Now you have to modify the chooser code to use the -H value for selection:

#!/bin/sh
while [ "$1" ] ; do
        case $1 in
        -H* ) host=$1;;
        esac;
done
host=`echo $host | sed s/-.//`;
case $host in
        192.1.1.1 ) pr=lp1;;
        * ) pr=lp2;;
esac
echo $pr
exit 0

You can even use:

.common:lp=/var/spool/lpd:
lp:tc=.common:chooser=/usr/lib/libexec/chooser:
#!/bin/sh
while [ "$1" ] ; do
        case $1 in
        -H* ) host=$1;;
        esac;
done
host=`echo $host | sed s/-.//`;
case $host in
        192.1.1.1 ) [EMAIL PROTECTED];;
        192.1.1.2 ) [EMAIL PROTECTED];;
esac
echo $pr
exit 0

Patrick Powell                 Astart Technologies
[EMAIL PROTECTED]            6741 Convoy Court
Network and System             San Diego, CA 92111
  Consulting                   858-874-6543 FAX 858-751-2435
LPRng - Print Spooler (http://www.lprng.com)

-----------------------------------------------------------------------------
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 [EMAIL PROTECTED] (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 [EMAIL PROTECTED]
with:                           | example:
subscribe LIST <mailaddr>       |  subscribe lprng-digest [EMAIL PROTECTED]
unsubscribe LIST <mailaddr>     |  unsubscribe lprng [EMAIL PROTECTED]

If you have major problems,  send email to [EMAIL PROTECTED] with the word
LPRNGLIST in the SUBJECT line.
-----------------------------------------------------------------------------

Reply via email to