Operating System - HP-UX
1825592 Members
1995 Online
109682 Solutions
New Discussion

Import/Export printers from a server to another one...

 
Jonathan Caplette_1
Super Advisor

Import/Export printers from a server to another one...

Hi guys,

I have some cluster that on them the list of defined printers is not the same on each node. I want that the list of my printers be the same on each node, and I don't want to recreate each printers...

Do anyone know how to do it?? Can I merge the list of defined printers??

Thanks
Jonathan
5 REPLIES 5
Cheryl Griffin
Honored Contributor

Re: Import/Export printers from a server to another one...

On the source system:

Execute
-> SAM
-> Printers and Plotters
-> Lp Spooler
-> Save/Restore Spooler Configuration

Choose
-> Actions
-> Save Spooler Configuration

This will save all the information necessary to rebuild the spooler into the
directory /var/sam/lp.

Tar this directory (/var/sam/lp) :

# tar cvf /tmp/lp.tar /var/sam/lp

Copy the resulting tar file, lp.tar, onto the target system.

Unpack the lp.tar file on the target system :

# tar xvf lp.tar


Execute
-> SAM
-> Printers and Plotters
-> Lp Spooler
-> Save/Restore Spooler Configuration

Choose
-> Actions
-> Restore Spooler Configuration
"Downtime is a Crime."
Pete Randall
Outstanding Contributor

Re: Import/Export printers from a server to another one...

Jonathan,

You can use SAM to save your printer config and then copy it to the other server and restore it with SAM.

I like to use a simple little script, though. Build a list of the printers on the one system that is going to be source - you can use lpstat and edit the output. Then the script is just a for loop. My version is attached.


Pete


Pete
Geoff Wild
Honored Contributor

Re: Import/Export printers from a server to another one...

or from command line:

/usr/sam/lbin/lpmgr -S -v -xsavedir=/var/sam/lp/
cp -r -p /var/sam/lp/lp.new/* /var/sam/lp/

tar up /var/sam/lp/ and ftp to remote server.

On remotes, un tar the tarball, then:

lpshut
/usr/sam/lbin/lpmgr -R -xsavedir=/var/sam/lp/
lpsched -v

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.
A. Clay Stephenson
Acclaimed Contributor

Re: Import/Export printers from a server to another one...

I wouldn't advise trying to merge print queues. I would instead get one host "perfect" and then replicate it.

The steps to replicate are quite simple.

1) On the "perfect" host, do an lpstat -t and look for any hung/bad printjobs and cancel them. There is no need to copy these old jobs.

2) lpshut

3) cd /
find /var/spool/lp /etc/lp -print | cpio -ocv > /var/tmp/lp.cpio

4) lpsched

5) On the destination host:
lpshut
find /var/spool/lp /etc/lp -print | cpio -ocv > /var/tmp/lp.cpio.save (in case something goes wrong)
ftp or rcp the lp.cpio file from the "perfect" host.

6) cpio icvdum < /var/tmp/lp.cpio

7) lpsched

Now everythinmg should be replicated including the default printer. You do need to make sure that host names for printer resolve equally well on all hosts but if you are using DNS, NIS, NIS+ or LDAP to resolve hostnames this shouldn't be a problem otherwise you will need to make sure that all the printers are defined in /etc/hosts on each box.
If it ain't broke, I can fix that.
dag richards_1
New Member

Re: Import/Export printers from a server to another one...

Moving between Jetadmin and HPPI

Use procedure listed above

--------------

/usr/sam/lbin/lpmgr -S -v -xsavedir=/var/sam/lp/
cp -r -p /var/sam/lp/lp.new/* /var/sam/lp/

tar up /var/sam/lp/ and ftp to remote server.

On remotes, un tar the tarball, then:

lpshut
/usr/sam/lbin/lpmgr -R -xsavedir=/var/sam/lp/
lpsched -v

--------------

then do the following:
#lpshut
#cd /opt/hpnpl/bin
# ./transferqueue local
#lpsched

This will shut down printing
and run a utility script that will convert your queues to the the new product.
Make sure you turn printing back on.