Operating System - HP-UX
1767188 Members
6438 Online
108959 Solutions
New Discussion юеВ

Re: moving all printer queues from one server to another

 
SOLVED
Go to solution
Mel Burslan
Honored Contributor

moving all printer queues from one server to another

I have a dilemma in my hands. I need to revamp all printer queue definitions on multiple servers. Print queues got created but never get deleted as the actual devices disappeared from the landscape for years coming to this point. Now, I got the queues under control on one server, by few weeks of gruelling deletions, creation and talking to people over the phone for what seemed to be endless hours.

I need to make other servers follow the suit. So, I used the

/usr/sam/lbin/lpmgr -S -xsavedir=/tmp/lpdefs

and I will transfer the directory with its contents to the other unruly nodes. Then I will run

/usr/sam/lbin/lpmgr -R -xsavedir=/tmp/lpdefs

command to restore them. So far so good. One question is lingering on my mind:

Is the restore printer queues process destructive or merging in nature ? In other words, will the process destroy my older queues or just create the queues which are not already there and maybe update the existing queue definitions. I couldn't figure this part out.

I need all the old queues to be destroyed on the target servers. Not merging. What is the best way to accomplish this instead of going through the queues one by one and removing them individually ? Or is this taken care of by the restore process ? I do not care if a few current print jobs get lost in the process. I just need to do this fast some time in the middle of the night.

As always, thanks for your help in advance.
________________________________
UNIX because I majored in cryptology...
6 REPLIES 6
Geoff Wild
Honored Contributor
Solution

Re: moving all printer queues from one server to another

They will be destroyed....

If you run it from sam - it will actually prompt you "are you sure?"

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.
Mel Burslan
Honored Contributor

Re: moving all printer queues from one server to another

Thanks for the answer Geoff..

Now another question:

When I add onesy-twosy type additional printers to the server I am using as a printer landscape template, is there a way to export the newly added printers into a similar structure to be imported by the satellite nodes ?

Thanks again in advance.
________________________________
UNIX because I majored in cryptology...
Tor-Arne Nostdal
Trusted Contributor

Re: moving all printer queues from one server to another

Hi Mel.
I have used scripts to copy/distribute print configs between multiple servers, and used one server as the "master".

I used /var/sam/lp as the savedir. This was to make my script routines "compatible" with SAM.
--------------------------------
Distributing entire print config
--------------------------------
1) On Master - Save config
/usr/sam/lbin/lpmgr -S -xsavedir=/var/sam/lp
2) On Slave - Copy entire /var/sam/lp
remsh $MASTER "(cd /var/sam;tar cf - ./lp)"| (cd /var/sam;tar xf -)
3) On Slave - Restore config
/usr/sam/lbin/lpmgr -R -xsavedir=/var/sam/lp

nb! warnings
* You should clean out old saved files in /var/sam/lp so that old queues is not restored
* scheduler should be stopped during restore
- just remember to start it afterwards :-)
--------------------------------
Copying single printer
--------------------------------
The save/restore is nice for distributing the entire print config, but if you want to do update on a single printqueue I recommend to do the following:

1) On Slave -create the queue (if not exist)
Example:
lpadmin -p${QUEUE} -v/dev/null -i/opt/hpnp/sh/dumbplot >/dev/null
2) On Slave - copy from Master
- the queue def from the "master node" to the "slave node"
cd /etc/lp/interface
rcp ${MASTER}:/etc/lp/interface/${QUEUE}
cd model.orig
rcp ${MASTER}:/etc/lp/interface/model.orig/${QUEUE}
3) On Slave - fix permissions
chown lp:bin ../${QUEUE} ${QUEUE} >/dev/null
chmod 755 ../${QUEUE} ${QUEUE} >/dev/null
3) Activate the queue
disable ${QUEUE} >/dev/null 2>&1
enable ${QUEUE} >/dev/null 2>&1
accept ${QUEUE} >/dev/null 2>&1

nb! Warning.
* If queue does not exists, you must stop the scheduler before defining it.
- I normally run a lpshut before I copy and a lpsched after the job is done
I'm trying to become President of the state I'm in...
Geoff Wild
Honored Contributor

Re: moving all printer queues from one server to another

For onsey's twosey's - I find it faster to just re-create the queue(s) on the second machine...

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.
Tor-Arne Nostdal
Trusted Contributor

Re: moving all printer queues from one server to another

Sometimes I have had to modify the model files to ensure proper handling.
Also the /etc/lp/interface/QUE file (like for port number other than 9100)

This is the reason why I rather copy it and thus make sure I use the exact same config and exactly the same model files...
I'm trying to become President of the state I'm in...
Mel Burslan
Honored Contributor

Re: moving all printer queues from one server to another

Thanks for the answers
________________________________
UNIX because I majored in cryptology...