Operating System - HP-UX
1819825 Members
3112 Online
109607 Solutions
New Discussion юеВ

How to check if a Printer is Defined on another UNIX Print Server

 
Alzhy
Honored Contributor

How to check if a Printer is Defined on another UNIX Print Server

Does anyone have any quick trick to check from one UNIX machine if a printer is defined on another UNIX machine (acting as a print server)?

Am developing a script to add printers pointing to printers defined on a designated UNIX print server. One check I'd like to add is to check whether the printer is defined on the remote UNIX Print Server. It seems "lpadmin" when performing an add, does not check the existence of the printer on the Print Server.

Thanks.

Hakuna Matata.
3 REPLIES 3
Geoff Wild
Honored Contributor

Re: How to check if a Printer is Defined on another UNIX Print Server

The only way I can think of is to use a remote command - like remsh or ssh to that server and execute
lpstat -pQUEUENAME

Now, if the queues are different, then you have more work...

Basically, you would have to do a remsh (or ssh) to the remote system, and grep for the hostname in /etc/lp/interface/*

or ip address if you use ip's instead of hostnames (which is a bad thing!).

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Michael Bush
Occasional Advisor

Re: How to check if a Printer is Defined on another UNIX Print Server

I'm not sure how it would be done in a script (since the rlpstat command should not be invoked manually), but I do know of a way to do it from a Windows system using lpq:

C:\>lpq -Sgdosux.atl.hp.com -Psos01101

no entries
gdosux: Warning: sos01101 is down

gdosux: sos01101: ready and waiting

lpq -Ssystemname -Premoteprintername
Bill Hassell
Honored Contributor

Re: How to check if a Printer is Defined on another UNIX Print Server

Only the local system knows if it has printers attached, so you'll need to run lpstat -v on the remote system. Stay away from lpstat -t as it performs remote interrogation on network and shared printers and can easily hang.


Bill Hassell, sysadmin