Operating System - HP-UX
1822148 Members
4165 Online
109640 Solutions
New Discussion юеВ

How to change printer's name

 
Carme Torca
Super Advisor

How to change printer's name

Hi,

I need to change 100 printer's names in one HP-UX 11i. Only the name, not ip. Is there any way to do this, without do remove and add with hppi?. I would like to make an script.

Thanks a lot of!
Carmen.
Users are not too bad ;-)
8 REPLIES 8
Pete Randall
Outstanding Contributor

Re: How to change printer's name

I don't know of a rename command but it should be easy enough to come up with a script - something like this:

for PRNTR in `cat /tmp/printerlist`
do
removequeue -f -q $PRNTR
addqueue -h $IP -q $PRNTR -b off
done

You can use lpstat to create your list of printers.


Pete

Pete
Pete Randall
Outstanding Contributor

Re: How to change printer's name

Oops! That doesn't give you the IP address $IP, does it. You'll have to retrieve that and set both in your script. I borrowed this from a script of mine where I cat the printerlist file and run it through a case statement to get the IP:

for PRNTR in `cat /tmp/printer_list`
do
case $PRNTR in
crlzr2_nf) IP=130.1.1.74
;;
crlzr3_nf) IP=130.1.1.72
;;
registry2) IP=130.1.7.73
;;
*) OPRNTR=$PRNTR
esac

Expand as needed for all your printers.



Pete

Pete
Rick Garland
Honored Contributor

Re: How to change printer's name

There are many areas in which the system keeps track of printers.

Starting at /etc/lp and going down to /var/spool/lp and going down.

It is almost easier to remove and add using a script
A. Clay Stephenson
Acclaimed Contributor

Re: How to change printer's name

If you have made any changes to customize the interface files, you need to be aware that this will take special work and can probably best be done manually (if there are only a few). Have you customized any of the interface files?

Are you changing the queue names or simply changing the hostname?

Did you hardcode the IP address or did you use hostnames?

Before making any suggestions, these data should be known.

At the very least, you should backup your current configuarion before doing anything so that you can get yourself out of trouble almost as easily as you got yourself in.


If it ain't broke, I can fix that.
Carme Torca
Super Advisor

Re: How to change printer's name

Hi,

I only want to change the hostname, and we use hostnames.
Is there any way to change only this, maybe one command??

Thanks very much.
Carmen.


Users are not too bad ;-)
Rick Garland
Honored Contributor

Re: How to change printer's name

A quich, simple way would be to create aliases for these.

You donot have to modify the lp config yet you have the printers known as the new name as well.

Carles Viaplana
Valued Contributor

Re: How to change printer's name

Hi!

As Rick said, you can modify/add entries on /etc/hosts file with printers IP addresses, their old names and new ones.

Regards,

Carles
A. Clay Stephenson
Acclaimed Contributor

Re: How to change printer's name

In that case, I would create a text file with
a line:
queuename newhostname
for each printer:

Then read each line and in the file
/var/spool/interface/${queuename} look for the line "PERIPH=xxxxx" and replace it with the line "PERIPH=${newhostname}"

This would be easy using Perl, awk, or sed.
If it ain't broke, I can fix that.