Operating System - HP-UX
1832978 Members
3154 Online
110048 Solutions
New Discussion

consolidating printer queue definitions from multiple hosts

 
SOLVED
Go to solution
Franky Leeuwerck_2
Super Advisor

consolidating printer queue definitions from multiple hosts

Hi experts,

I need to consolidate several dbms systems on HP-UX PA-Risc to a single HP-UX Itanium.

Moving the printer queue definitions is one aspect of the migration.

I used a script I found posted by Geoff Wild in this fora a while ago :

============================
/usr/sam/lbin/lpmgr -S -v -xsavedir=/var/sam/lp/
cp -r -p /var/sam/lp/lp.new/* /var/sam/lp/
tar cvf /tmp/lp.tar /var/sam/lp/
ftp /tmp/lp.tar to remote server
Untar it, then:
lpshut
/usr/sam/lbin/lpmgr -R -xsavedir=/var/sam/lp/
lpsched -v
=================================

It worked well, for the first system. I could see all printer definitions on the new machine correctly.
However, I tried out the same procedure for the 2nd system. As a result the first set of definitions were overwritten.

Then I tried to merge /lp/ subdirectories, created on the 3 systems with "lpmgr -S -v -x savedir=/var/sam/lp/ ", but also this resulted in only 1 subset on the new system.

Any idea's ?
Something with the timestamp ?

I have not done such work before, so this is new to me.

Thanks in advance for your help.

Franky
9 REPLIES 9
Geoff Wild
Honored Contributor
Solution

Re: consolidating printer queue definitions from multiple hosts

Franky,

I don't think this is possible - with SAM - consolidate queues from multiple servers...

I think you will be faced with the dubious task of adding them manualy....


That said, you should be able to script that - and add them all at once...

I did something simliar moving from multiple AIX servers to a single HP-UX one:

#!/bin/sh
# script to add-delete queues
# Geoff Wild
#
if [ $# -lt 1 -o ( $# -gt 1 -a $# -lt 4 ) ]
then
echo "Usage:"
echo "queue-admin "command""
echo "Example:"
echo "queue-admin addqueue"
echo "queue-admin removequeue"
exit 1
fi


if [ $1 = "addqueue" ] ; then
exec 0while read line
do
p=`echo ${line}|awk '{print $1}'`
echo "adding queue " ${p}
# 9998 is net_genericprinter Modelscript
$1 -i 9998 -h ${p}.yourdomain.com -q ${p}
done
else
lpshut
exec 0while read line
do
p=`echo ${line}|awk '{print $1}'`
echo "removing queue " ${p}
lpadmin -x${p}
done
lpsched
fi

You need to create a file called printer.name.list.out (you can do that on all servers, then concatenate the file on the single server).



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.
Franky Leeuwerck_2
Super Advisor

Re: consolidating printer queue definitions from multiple hosts

Hi Geoff,

Thanks for the input.
I created a file containing all the names of the printers from 3 different hosts :
printername1
printername2
.. etc ..

I ran the "queue-admin addqueue" script.
For every printer I get the following error :

adding queue printername1
./queue-admin[20]: addqueue: not found

Line 20 is :
$1 -i 9998 -h ${p}.bekaertcorp.local -q ${p}

Franky
Geoff Wild
Honored Contributor

Re: consolidating printer queue definitions from multiple hosts

Make sure /opt/hpnpl/bin/ is in your $PATH.

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.
Geoff Wild
Honored Contributor

Re: consolidating printer queue definitions from multiple hosts

BTW - if that dir doesn't exist, then download and install " HP JD Printer Installer for HP-UX 11.x "

http://www.hp.com/go/hppi_sw


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.
Franky Leeuwerck_2
Super Advisor

Re: consolidating printer queue definitions from multiple hosts

Hi Geoff,

I installed the HP JetDirect PrintInstaller which was missing. Thanks for the tip.

Then I ran the script.

For every printer it showed these errors :
adding queue printername1
printername1.mydomain.com: Unknown printer
Error sending SNMP request.

I do see all printers in SAM.

Can you tell me what the errors are about ?
Is the setup finished ?

Regards,
Franky
Geoff Wild
Honored Contributor

Re: consolidating printer queue definitions from multiple hosts

Just checking the obvious, for printername1.mydomain.com

is it in DNS? and I'm assuming you changed mydomain.com to your real domain?

The printer will be added - but you have to make sure it is in DNS.

No need to rerun the script - just update your DNS.

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.
Franky Leeuwerck_2
Super Advisor

Re: consolidating printer queue definitions from multiple hosts

Hi Geoff,

In real, I use the real printer names ..

Further,
printername1.yourdomain.com is not in DNS,
but printername1 can be resolved, as also printername1.olddomain.com can be resolved.

I know I used yourdomain.com in the script.
yourdomain.com is the domain for the host.

With the hppi tool, I tested a printer and the printer was recognized as an HP printer and the server was allowed to address it.

Can I conclude that this finishes the setup steps ?

Franky
Geoff Wild
Honored Contributor

Re: consolidating printer queue definitions from multiple hosts

Okay, as long as you can ping it - then it should be fine.

That said, you may have to delete all the queues and readd them - without using the fully qualified domain name...that is you said printername1 can be resolved but printername1.yourdomain.com can't...is that because the printers are in /etc/hosts?

If so, you have 2 choices - modify /etc/hosts to include the domain name or redo the queues without the domain name...


Here's a script I wrote to check printer status:

#!/bin/sh
#
# check printer status
# Geoff Wild

if [ $# -lt 1 -o \( $# -gt 1 -a $# -lt 4 \) ]
then
echo "Usage:"
echo "lpst \"printer\""
echo "Example:"
echo "lpst W052"
exit 1
fi
echo " "
/usr/sbin/ping $1 -n 2
echo " "
lpstat -p$1 -v$1
echo " "
echo "Output Requests"
echo "-----------------------------------------------------------"
lpstat -o$1
echo " "
lpstat -r
echo " "


So, try it like:

lpst printername1

And one more command I use - /opt/hpnpl/bin/hpnpadmin

Great for getting details on the printer...

Example:

# hpnpadmin -i W052
Printer Description:
--------------------
MFG :Hewlett-Packard;
CMD :PJL,MLC,PCL,POSTSCRIPT,PCLXL,PJL;
MDL :HP LaserJet 4100 Series ;
CLS :PRINTER;
DES :Hewlett-Packard LaserJet 4100 Series;

Printer ID : 271

And with -v
hpnpadmin -v printername
will give you a bunch of info...



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.
Franky Leeuwerck_2
Super Advisor

Re: consolidating printer queue definitions from multiple hosts

Geoff,

The printernames are not present in the /etc/hosts file.
So, I guess that's ok then.

In attachment I added the output of your printer check statements.

All look fine.

Many thanks for your sharings in this helpfull thread.
I'm sure others will benefit from it too.


Regards,
Franky