Operating System - HP-UX
1833163 Members
3316 Online
110051 Solutions
New Discussion

Re: how to define many printers automatically

 
SOLVED
Go to solution
federico_3
Honored Contributor

how to define many printers automatically


I have about 200 hundreds networks printers defined ( using jetadmin ) on a HP-UX system. How can i define them automatically on another HP-UX system without doing it by hand ?
5 REPLIES 5
Volker Borowski
Honored Contributor

Re: how to define many printers automatically

You could create a script, containing the apropriate lpadmin-commands:

Assuming a printer lp on a remote system system2, the command:

/usr/sbin/lpadmin -plp3 -v/dev/null -mrmodel -ocmrcmodel -osmrsmodel -ob3 -ormsystem2 -orplp -v/dev/null

causes the spool system to use the local line printer lp3 and the model rmodel. The spool system also uses the model rcmodel to cancel remote requests and rsmodel to get status from system2. In addition, the three-digit sequence numbers, the remote system name system2 and the remote printer lp are used.

So assuming, you create yourself an input file in the format:

local_printer_name remote_system remote_printer_name

you could go like (all in one line)

cat my_list_of_printers |
awk '{ print "/usr/sbin/lpadmin -p" $1 "-v/dev/null -mrmodel -ocmrcmodel -osmrsmodel -ob3 -orm" $2 " -orp" $3 " -v/dev/null" }' > create_them.sh

You could extend this, if you need to set parameters for the modelscripts as well.

Volker
Volker Borowski
Honored Contributor

Re: how to define many printers automatically

oh, forgot:

to get the input list, you might start to
catch "lpstat -t" in a file, and use an editor which is column mode capable.

Volker
Jordan Bean
Honored Contributor

Re: how to define many printers automatically

John Waller
Esteemed Contributor
Solution

Re: how to define many printers automatically

This would not be a supported way but I have managed to do somthing similar by using a rcp and two remsh commands. On the machine which has all the printers perform the following:

1. rcp /etc/host newmachine:/etc/hosts

2. tar cf - /etc/lp | remsh newmachine tar xvf -

3. tar cf - /var/spool/lp | remsh newmachine tar xvf -

I ran this on a system with 10 printers configured (8 jetadmin and 2 remote printers) and it replicated the entire printer setup without any problems or further intervention.

P.S You need to be careful with the rcp of the host file it may be safer to rcp to a temp file then vi /etc/passwd, :r /tmp/hosts (read /tmp/hosts within vi) then delete any unwanted enteries.
Dan Zucker
Regular Advisor

Re: how to define many printers automatically

It was not clear from you question if you want to duplicate the machine with the printers or have other machines point to the machine with printers.

The "supported" to copy is to use SAM and
export from one machine tar /var/sam/lp(default and can be changed) and decendents, move the tar to the new machine, untar,
and import.

This works in HPUX10.20 and 11.00. I do not remember it in 9.04, and those are the OS I have used.