From Wiki-UX.info

Wiki-UX / Jetdirect / How to add a HP-UX printer using Jetdirect addqueue or lpadmin commands
Jump to: navigation, search

How to add a HP-UX printer using Jetdirect addqueue or lpadmin commands

Abstract

This article describes two methods to add a network printer queue from the command line without using the Jetdirect hppi command.

The first method uses the addqueue command, probably the easier.

The second method uses traditional lpadmin commands, a bit more complex, but based on bundled HP-UX LP Spooler administration commands.

Contents


Using addqueue command

The addqueue command is available on system that have the latest version of HPNPL Installed.

# swlist | grep JetDirect
  J4189-11001C                  E.10.34        Hewlett-Packard JetDirect Printer Installer for Unix
# man addqueue
 
NAME
     addqueue offers an alternate method of creating queues for printers
     connected with HP JetDirect interface cards.
 
SYNOPSIS
     addqueue [ -c  class ] [-d] [ -i  printerID ] -h  hostname -q
      queuename [-p  port] [-s ] [-r  on/off] [-t  on/off] [-b  on/off] [-L
      PS/PCL/HPGL/HPGL2/AUTO] [-P  1/2/3] [-T  1/2/3] [-m  banner papersize]
     [-D  on/off]
 
     addqueue [-l]

The minimal information required for adding a printer queue with this commands are the printer ID number(Modelscript number), the remote hostname / IP Address of the Jetdirect card and the name of the new printer queue. To find the available printerID(s), you can use the -l option of the addqueue command to generate a list.

Example

Adding a LaserJet 4730MFP printer to the system using the already installed model script. The printer JetDirect card IP Address is 16.90.48.115. A entry has beed added to the /etc/hosts to use 4730mfp as the printer hostname. The banner page will be disable.

# grep 4730 /etc/hosts
16.90.48.115    4730mfp.americas.hpqcorpt.net 4730mfp
# addqueue -l | grep 4730
 2818)          HP ColorLaserjet Jet 4730mfp Series     net_clj4730mfp
# addqueue -i 2818 -h 4730mfp -q 4730mfp -b off
4730mfp added to spooler.
# lpstat -p4730mfp
printer 4730mfp is idle.  enabled since Sep 28 13:01
        fence priority : 0
 
DEPENDENCIES
    The addqueue program has to stop the scheduler to perform its tasks.
    When the scheduler is stopped, all print jobs will be halted and
    restarted when the scheduler is turned back on.

Using lpadmin command

# mkdir /etc/lp/interface/model.orig  (if you don't have it) 
 
# chown lp:bin /etc/lp/interface/model.orig
 
# chmod 755 /etc/lp/interface/model.orig

Then go ahead and setup your printer with 'lpadmin' after you shutdown the scheduler. Nobody can print on this system while the scheduler is down, so it may be necessary to schedule print down on heavily used print servers.

# /usr/sbin/lpshut 
# /usr/sbin/lpadmin -p<queue_name> -v/dev/null -m<interface_modelscript>

The lpadmin commands searches the model script under /var/spool/lp/model directory. Any JetAdmin scripts needs to be installed under that directory to sucessfully use lpadmin.

Verify that the interface model scripts for JetAdmin printers are in the correct directories:

# cd /var/spool/lp/interface
 
# mv <printer_name> model.orig/<printer_name>
 
# cp /opt/hpnpl/sh/hpnp.model <printer_name>
 
# chown lp:lp <printer_name> model.orig/<printer_name>
 
# chmod 755 <printer_name> model.orig/<printer_name>

Now enable the printer and restart the scheduler:

# accept <printer_name>
 
# enable <printer_name>
 
# /usr/sbin/lpsched

You can test the configuration issueing a new print job with the lp commands:

# lp -d<queue_name> <file_to_print>

To test if the connection to the printer can be establish without sending a print job through the spooler use "hpnpg" command:

# /opt/hpnpl/bin/hpnpf -x <printer_name_or_ip> -l <log_file_name> <file_name_to_print>

References

Authors

This page was last modified on 19 July 2010, at 16:09. This page has been accessed 6,789 times.