[cups] Query queue Location/Description from command-line?

Bryan Mason bjmason at redhat.com
Wed Apr 12 16:52:25 PDT 2023


On Tue, 2023-03-28 at 12:14 -0800, Peter Schultz wrote:
> I'm trying to write a script to synchronize related print queues via
> the command-line and I need to determine the given queue's Location
> and Description attributes (set via lpadmin) via script.
> 
> I'd rather not have to run this script as an elevated user, meaning
> I'd rather avoid parsing printers.conf.
> 
> I've perused all of the manpages I can find and nothing seems to let
> me do this. Is there something I'm missing? Should I just curl
> localhost:631 for the printer in question?

"lpstat -lp" provides me with Location and Description information:

$ lpstat -lp
printer hp-m477fdn is idle.  enabled since Wed 15 Mar 2023 12:30:46 PM PDT
	Form mounted:
	Content types: any
	Printer types: unknown
	Description: HP Color LaserJet MFP M477fdn
	Alerts: none
	Location: Home Office
	Connection: direct
	Interface: /etc/cups/ppd/hp-m477fdn.ppd
	On fault: no alert
	After fault: continue
	Users allowed:
		(all)
	Forms allowed:
		(none)
	Banner required
	Charset sets:
		(none)
	Default pitch:
	Default page size:
	Default port settings:

Not sure if this is the information that I used when I installed the
printer via lpadmin, but it's there.

~ Bryan




More information about the cups mailing list