> From [EMAIL PROTECTED] Fri Jun 30 13:28:06 2000
> Date: Fri, 30 Jun 2000 15:09:26 -0400
> From: "William R. Knox" <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: LPRng: Question and interesting observation (bug?)
>
> First the question -
>
> We are upgrading from LPRng 3.6.5 to LPRng 3.6.19, and are interested in
> maintaining the 'check_idle' functionality that was available
> previously. When I run checkpc on a queue that has this attribute, it
> tells me that I should use the new 'chooser' option instead. However, I
> am not doing load balance queues or printer pools - I merely don't want
> to try and send the job unless I have confirmed that the printer is
> there. Is there any solution to this? Simply dropping 'chooser' into
> place instead of 'check_idle' doesn't seem to have done it.
>
I just tested this, and the 'chooser facility' appears to do the same work.
You need to modify your existing check_idle facility so that
it does the following, and then set :chooser=/path in the printcap.
a) the list of queues to check is read from STDIN.
For your purposes, this is only a single queue, so you can
just read STDIN and save the value.
b) You do your check_idle routine - you can block, but if you do
the entire queue will come to a grinding halt. So you should
put in some 'reasonable' timeouts.
c) If the printer is busy, then simply exit with 0 status and do
not write anything to STDOUT. If the printer is available,
exit with 0 status and write the printer name to STDOUT.
d) In the next release you will be able to write 'pr@host' to
STDOUT and this will act to send the job to 'pr@host'. This
will do routing at the back end rather than front end of the
spooling process. So now you can do dyamic routing as well.
You can test the chooser stuff by using the following simple script:
#!/bin/sh
echo CHOOSER $* $@ >>/tmp/chooser
set >>/tmp/chooser
# return the first printer on the list
# comment this out if you want to use the
# routing facility shown below.
/usr/bin/head -1
# uncomment to have job sent to t4@localhost
# replace with the queue of your choice
#echo t4@localhost
exit 0
This just dumps the parameters to /tmp/chooser so you can look at them,
and then reads STDIN and returns the first in the list.
Now, you can do something interesting like:
if lpq -Pt4@localhost -s | grep -q '0 job' ; then
echo t4@localhost
fi
exit 0
You can replace this with your specialized checking code, of course.
Patrick Powell Astart Technologies,
[EMAIL PROTECTED] 9475 Chesapeake Drive, Suite D,
Network and System San Diego, CA 92123
Consulting 858-874-6543 FAX 858-279-8424
LPRng - Print Spooler (http://www.astart.com)
-----------------------------------------------------------------------------
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.
-----------------------------------------------------------------------------