[cups.general] option "-h server" versus cupsd on domain socket

Johannes Meixner jsmeix at suse.de
Tue May 20 23:55:41 PDT 2008


CUPS client tools like lpstat, lpinfo, and lpadmin have
the "-h hostname[:port]" option to explicitely specify the
hostname where to talk to the cupsd which overrides settings
in the environment like "CUPS_SERVER=otherhost.somewhere".

I use in particular explicitely "-h localhost" for queue setup
actions (i.e. in lpinfo and lpadmin) to make sure that I do
the setup action really on my local host and not on whatever
unexpected other host because of whatever environment setting.

Unfortunately "-h localhost" does not work if the local
running cupsd does not listen on the interface
but only on the Unix domain socket, i.e. when there is
in cupsd.conf
# Only listen for connections from the local machine.
#Listen localhost:631
Listen /var/run/cups/cups.sock
In this case e.g. "lpinfo -h localhost -v" results
"Unable to connect to server: Connection refused".
But in this case the commands work without "-h localhost"
and usually they talk to the local running cupsd.
Currently I run CUPS version 1.3.7.

My question is:
How can I make sure to talk to the local running cupsd
even if it listens only on the domain socket?

More precisely:
I am looking for a command line option or a particular
environment variable setting which makes sure to talk
exactly to a local running cupsd regardless how it
actually connects to the local running cupsd.

Do you think it is a reasonable feature request that
CUPS client tools talk via the domain socket as fallback
when connecting via the interface fails
if "-h localhost" was specified?

By the way:
Is there a command line tool which tells me to which cupsd
(i.e. hostname and port) it connects by default?

Something like a more verbose output of "lpstat -r" e.g. when
it responds "scheduler is running on <hostname>:<port>"
versus "Unable to connect to server on <hostname>:<port>"?

Would this be another reasonable feature request
to let "lpstat -r" respond on which hostname and port the
cupsd is running or where exactly it fails to connect?

Kind Regards
Johannes Meixner
SUSE LINUX Products GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
AG Nuernberg, HRB 16746, GF: Markus Rex

More information about the cups mailing list