Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Solaris 2.6 "lpstat -p" timeout issue

0 views
Skip to first unread message

Michael St. Laurent

unread,
Mar 18, 2004, 1:39:36 PM3/18/04
to
We have a program that parses the output from the "lpstat -p" command
to gather information about the state of our spooler. Unfortunately,
there is a real speed issue involved as the lpstat command uses a
fifteen second timeout. I'm looking for a way to lower the latency.
I've been told that one way is to limit the number of printers being
polled by using adding an all= list in the /etc/printers.conf file.
However, this file does not affect the behaviour of lpstat when the -p
option is being used. It still tries to list all printers.

Is there an alternate to using the "lpstat -p" command? I need to
list each printer and determine whether or not it is currently
printing something.

Greg Andrews

unread,
Mar 18, 2004, 4:37:29 PM3/18/04
to
mi...@hartwellcorp.com (Michael St. Laurent) writes:
>
>Is there an alternate to using the "lpstat -p" command? I need to
>list each printer and determine whether or not it is currently
>printing something.
>

"lpstat -p" works well for local and network printer queues.
It does not work well for remote printer queues, particularly
when the print server does not respond quickly.

I believe the delays you're experiencing are due to the latter
problem. You have printers defined as remote printers on this
Solaris computer, and when lpstat tries to contact the print
server through the network to learn the queue status, the print
server responds slowly (or the DNS lookups to find the print
server's IP address are slow).

If this Solaris machine delivers the print jobs directly to the
printers (not by giving the jobs to another computer), then you
are probably using the wrong configuration. Use the network
printer configuration for printers attached to the network, and
the local printer configuration for printers attached to the
serial or parallel port of this Solaris machine. Then lpstat -p
asks the local lpsched daemon for the queue info and receives the
answer quickly.

The other potential problem is the thing I hinted at above: DNS.
Are DNS lookups slow for some of the print servers some of the
time? This can be true for print servers at sites different
from your own. Your DNS servers try to find the DNS servers for
the other site, but don't get a fast response.

Another question is: Why does your program care how many jobs
are printing on the printer? Shouldn't managing printer queues
be performed by the print server software rather than your
application? Solaris has printer classes specifically designed
to send print jobs to idle printers when others are busy (and
the idle printers are equally capable of printing the job as the
busy ones). Perhaps you can avoid the whole problem by re-thinking
the need to know how many jobs are printing in each queue.

-Greg
--
Do NOT reply via e-mail.
Reply in the newsgroup.

0 new messages