Operating System - HP-UX
1845932 Members
4140 Online
110250 Solutions
New Discussion

changing printer name from shell

 
Rich Rankin
New Member

changing printer name from shell

We added several (10s) of printers names incorrectly. We would like to change the names using a script instead of changing from jetadmin.

Can this be done and what are the steps.

Thanks in advance,

Rich

HPUX 11.11
7 REPLIES 7
harry d brown jr
Honored Contributor

Re: changing printer name from shell

I would think by the time you wrote a script, you could probably change the names of the printers manually.

live free or die
harry
Live Free or Die
Rich Rankin
New Member

Re: changing printer name from shell

There are 113 printers that need to be changed.
Craig Rants
Honored Contributor

Re: changing printer name from shell

lpadmin -p -m -v will add a printer
lpadmin -x will delete a printer

I would usually recommend using jetadmin for adding printers, however 113 would take some time. If they are all the same type of printer your script could probably be pretty easy because the -m option would stay the same, if not, hire a junior admin and make this their project (just joking)

GL,
C
"In theory, there is no difference between theory and practice. But, in practice, there is. " Jan L.A. van de Snepscheut
harry d brown jr
Honored Contributor

Re: changing printer name from shell

OK, lets gather some info:

-> What kind of printers?
-> Are they all on the network?
-> How many servers have been set up to use these printers (using the incorrect names)?
-> What are the existing names and what do you want to change them to?
-> Was bootp used?

live free or die
harry
Live Free or Die
Mark Greene_1
Honored Contributor

Re: changing printer name from shell

get a copy of expect and load it on your system. You can feed the inputs into Jetadmin with it to change the printer names. Be sure to get a list of the existing printer names to a file, something like lpstat -a |cut -d" " -f1 >filename so you can use that list to feed the expect script.

HTH
mark
the future will be a lot like now, only later
Rich Rankin
New Member

Re: changing printer name from shell

The printers already exist on the system. They were added with Uppercase names and instead of spending the 4 hrs to change them through Jetadmin, we wondered if the shell ability was available.

TAI,

Rich
Deshpande Prashant
Honored Contributor

Re: changing printer name from shell

Hi
The commands "addqueue" and "removequeue"
in script loop will help you remove old queue and create new queue.

#removequeue -q
#addqueue -q -h

If you want to convert all prin queue names from upper case to lower case
List all queuenames.

#lpstat -p |grep printer |awk '{print $2}' >printer_queuenames

Convert all names in above file to lower case and use the files with removequeue and addqueue commands to delete old queues and create new queues.

Thanks.
Prashant Deshpande.
Take it as it comes.