AIX/HP-UX Interoperability Guide (continued)
[Last Chapter: 7. Backups]


8. Printing

In discussing UNIX printing, we have to be careful about the terms we use to avoid confusion. The respective documentation for AIX and HP-UX often use similar terms but with different meanings. In this document the following terms will be used consistently:

8.1 AIX

The AIX Queuing System

To print in AIX you use a proprietary queuing system that is not confined to printing alone. In other words, the queuing system accepts jobs other than print jobs. For purposes of this discussion, however, we will assume all jobs are print jobs.

You can submit print jobs with the enq command, the general queuing command, or you can use the qprt, lp, or lpr commands. AIX provides lp and lpr for purposes of compatibility with AT&T and BSD-style printing, but they do not represent completely different printing subsystems; they are simply front ends that do the same thing. All three print commands, qprt, lp, and lpr, call the enq command when invoked.

enq submits jobs to a queue, either one you specify or a default queue. In AIX-speak a queue is "an ordered list of requests for a specific device." [8] This device is known as a queue device, and is not the printer or even its device file. A queue device is actually a set of parameters for the print device. To illustrate this, let's look at a sample /etc/qconfig file. /etc/qconfig is the master configuration file for the queuing system. It is an ASCII file consisting of stanzas that describe queues and their associated devices. For example, an entry might look like the following:

lp0:
    device = pdev0
pdev0:
    file = /dev/lp0
    header = never
    backend = /usr/lpd/piobe

Queue lp0 is listed with an associated queue device of pdev0, which has three configuration parameters. file is the special device file of the printer. header specifies whether or not header pages are printed; in this case, no. backend is the program that actually sends jobs to the printer; in this case it is /usr/lpd/piobe.

The basic steps of the print process are:

  1. enq, either directly or through the qprt, lp, or lpr commands, submits jobs to a queue as defined in /etc/qconfig and places them in the /usr/lp/qdir directory.
  2. The qdaemon awakens and places the print spool file in /var/spool/qdaemon. The qdaemon, which is started at boot time, tracks print requests and printer availability. When a printer becomes available, qdaemon submits the job to the printer backend.
  3. The backend program sends the job to the printer and at the same time keeps status of the print job in the /usr/lpd/stat directory. This directory is consulted when you use one of the queue checking programs: qchk, lpstat, or enq -A commands.

Adding a Local Printer

  1. Start SMIT:

    # smit pdp

  2. Select Add a Printer/Plotter.
  3. From the Printer/Plotter Type menu, select the printer that either matches or closely resembles your printer.
  4. From the Printer/Plotter Interface menu, select either parallel, rs232, or rs422, depending on your connection.
  5. From the Parent Adapter menu select the appropriate adapter. For parallel you should see only one choice:

    ppa0 Available 00-00-0P Standard I/O Parallel Port Adapter

  6. For serial you should see two choices:

    sa0 Available 00-00-S1 Standard I/O Serial Port 1 sa1 Available 00-00-S2 Standard I/O Serial Port 2

  7. From the Add a Printer/Plotter menu type in the value for PORT number. If you are not sure what the port number is, press the F4 key in the field to get a list of port numbers. Press Return.
  8. SMIT then adds the printer to the customized configuration database and displays the following message:

    lp0 Available

The device file created for this process is /dev/lpN, where N is 0 for the first printer, 1 for the next printer, and so on.

Printing Locally

Adding a printer device to the system and creating its device file is not enough to get printing going on the RS/6000. You must create a virtual printer for every queue you plan on creating.

Virtual Printers

A virtual printer is "a set of attributes that define a specific software view of a real printer." [9] For example, if you attach a printer that supports only ASCII data streams, then you would create a virtual printer that sets up ASCII printing. If you have a PostScript printer, you need a PostScript virtual printer. If your printer supports multiple data streams, such as ASCII, PostScript, and PCL, you need to create a virtual printer for each. You create virtual printers for each workstation hosting a printer and for each workstation printing to a network-based printer.

Use the mkvirprt command to create a virtual printer. The following is an example of creating a virtual printer for a local HP LaserJet IIIsi. It assumes that the LaserJet device was added by the process described above in Adding a Local Printer.

# smit mkvirprt


     No.    Description
     1      Printer or Plotter Attached to Host
     2      Printer or Plotter Attached to Xstation
     3      Printer or Plotter Attached to ASCII Terminal
     4      Network Printer (Hewlett-Packard JetDirect)

Enter number from list above (press Enter to terminate):  ->  1

Choosing number 1 brings up the following:


      Name         Description
      lp0          Hewlett-Packard LaserJet IIISi
      lp1          IBM 2380 Personal Printer II
Enter device name (or, ! to exit):  (lp0)  ->

Under the Name column is the list of all printers by device name added to the system. Pressing Return here means you want to create a virtual printer for the first device listed, in this case lp0. At this point you get a list of printers. Following is a partial list.


     No.    Description
     36     IBM 5589 Model H01
     37     IBM 6180 Color Plotter
     38     IBM 6182 Auto Feed Color Plotter
     39     IBM 6184 Color Plotter
     40     IBM 6185-1 Color Plotter
     41     IBM 6185-2 Color Plotter
     42     IBM 6186 Color Plotter
     43     IBM 6252 Impactwriter
     44     IBM 6262 Printer
     45     IBM 7372 Color Plotter
     46     Canon Laser Shot LBP-B406S/D/E, A404E, A304E
     47     Dataproducts BP2000 Line Printer
     48     Dataproducts LZR 2665 Laser Printer
     49     Hewlett-Packard LaserJet II
     50     Hewlett-Packard LaserJet III
     51     Hewlett-Packard LaserJet IIISi
     52     Hewlett-Packard LaserJet 4
     53     OKI MICROLINE 801PS
     54     Printronix P9012 Line Printer
     55     Plotter

Enter number from list above (press Enter to terminate):  -> 51

In this example we choose number 51, representing the HP LaserJet IIISi. What follows is a series of questions.


Header pages wanted?  (n=none; a=each file; g=each job):  -> (n)
Trailer pages wanted? (n=none; a=each file; g=each job):  -> (n)
NOTE:   The hplj-3si printer supports multiple print data streams.
        Each of the data streams will now be configured individually.
--------------------  PostScript  --------------------
Enter print queue name (or, ! to bypass configuration):   -> (ps)ps1
Should this queue be the default queue? -> (y)
hplj-3si (PostScript) configured for print queue ps1
--------------------  PCL  --------------------
Enter print queue name (or, ! to bypass configuration):   -> (pcl)pcl1
hplj-3si (PCL) configured for print queue pcl1

In the first two questions we accepted the default value (n). Then we were informed that this printer supports multiple data streams: PostScript and PCL, for each of which we had to create a virtual printer. The first virtual printer was for the PostScript data stream and was given a queue name of ps1. The second was for a PCL virtual printer and was given the queue name of pcl1. The creation of these two virtual printers resulted in the following entries in the /etc/qconfig file:

ps1:
        device = lp0

lp0:
        file = /dev/lp0
        header = never
        trailer = never
        access = both
        backend = /usr/lib/lpd/piobe
pcl1:
        device = lp0
lp0:
        file = /dev/lp0
        header = never
        trailer = never
        access = both
        backend = /usr/lib/lpd/piobe

The queue ps1 was made the default queue and therefore appears first in /etc/qconfig. Each queue has the same queue device because we are printing to the same printer. However, if we want to print in PostScript mode, we use the first queue; for PCL, the second. For example,
For queue ps1:For queue pcl1:
# enqenq -Pps1 file # enqenq -Ppcl1 file
# qprtqprt -Pps1 file # qprtqprt -Pps1 file
# lplpAIX -dps1 file # lp -dpcl1 file
# lprlpr -Pps1 file # lprlpr -Ppcl1 file

Printing to a Remote Printer

The basic process of printing to a remote printer is to

  1. Attach a printer to the remote machine and add it as a local printer to the remote workstation.
  2. Start the lpd daemon on the remote machine and enable access to it from your local workstation.
  3. Create a remote queue on the local workstation.

Remote Workstation Setup

Attach a printer to the remote workstation in the same manner as described in Adding a Local Printer. Though you are setting up remote printing, the printer is a local printer to the remote workstation. The remote workstation with a printer attached is frequently called a print server; a local workstation printing to a print server is often called a print client. We will use that terminology here to help avoid some confusion in terminology. After you add the printer, do the following:

  1. Start SMIT:

    # smit server

  2. Select Host Access for Printing.
  3. Select Add a Remote Host.
  4. In the Add a Remote Host screen, fill in the name of your print client in the Name of Remote HOST field.

    The terminology here is confusing, but try to remember: what is local to you is remote to the remote workstation. You are adding a remote host name to the print server's list of authorized print client workstations This list is the /etc/hosts.lpd file..

  5. Return to the first menu by pressing the F3 key three times. Select lpd Remote Printer Subsystem.
  6. Select Start Using the lpd Subsystem.
  7. Select Start BOTH Now and at System Restart.

This selection starts the lpd and puts an entry into the /etc/inittab file for it to start upon boot.

Local Workstation Setup

  1. Start SMIT:

    # smit rq

  2. Select Add a Remote Queue. Fill in the following required values:
    * NAME of queue to add                            []
    * DESTINATION HOST for remote jobs                []
    * Pathname of the SHORT FORM FILTER for queue     [/usr/lpd/aixshort] +/
        status output
    * Pathname of the LONG FORM FILTER for queue      [/usr/lpd/aixlong]  +/
        status output
    * Name of QUEUE on remote printer                 []
    * NAME of device to add                           []
    * BACKEND PROGRAM pathname                        [/usr/lpd/rembak]
    

For NAME of queue to add, type in anything you want. It is a good idea, however, to use some kind of logical naming system, such as rlp0 (remote line printer 0). For DESTINATION HOST for remote jobs, type the hostname of the print server. Leave the FILTER fields the default unless you are printing to an HP-UX machine. See the section on Interplatform Printing for more information. For name of QUEUE on remote printer, type the name of the print server's local queue; typically it is lp0. For NAME of device to add, type anything you want, again something like drlp0 (device for rlp0) might be useful. Leave the BACKEND PROGRAM pathname /usr/lpd/rembak. This backend is designed to send print jobs to a print server running the lpd.

Thus when you print to a remote printer in AIX, the print job goes through two print queues. It is processed locally and passed to the remote backend (/usr/lpd/rembak), which then passes the job to the remote lpd, at which time the print job is processed as a local print job on the remote printer. When you type the lpstat command to get status on a print job you will see two queues listed, something like:

# lpstat
Queue   Dev   Status  Job Files         User         PP %   Blks  Cp Rnk
------- ----- ------- --- ------------- ---------- ---- -- ----- --- ---
rps1    drps1 READY
lp0     dlp0  READY

In this case queue rps1 prints to the remote queue lp0. Both queues service the same print job.

Printing to a Network-based Printer

AIX supports network-based printing if the networked printer supports a JetDirect card. For other types of cards or network printers, you need to install the appropriate software that comes with the card or printer. You use the mkvirprt command to create a virtual printer and associated queue to the network-based printer. For example, if you were to run mkvirprt for an HP LaserJet IIIsi that was hooked directly on the network, you would do the following:

# smit mkvirprt

You would then see the following screen:


     No.    Description
     1      Printer or Plotter Attached to Host
     2      Printer or Plotter Attached to Xstation
     3      Printer or Plotter Attached to ASCII Terminal
     4      Network Printer (Hewlett-Packard JetDirect)

Enter number from list above (press Enter to terminate):  ->  4
Enter the printer hostname:   ->   p2410l3si

Here we chose option 4 and entered the hostname of the printer, in this case p241013si. The next screen asks if you want to make this printer a boot/tftp server. In most cases you choose 2, for no.


     No.    BOOTP/TFTP Server
     1      Make this system a BOOTP/TFTP server
     2      Do NOT make this system a BOOTP/TFTP server

Enter number from list above (press Enter to terminate):  ->  2

The next screen displays possible printers. The example that follows shows a list that has been scrolled through a few times:


     45     IBM 7372 Color Plotter                           [ 44 more ]
     46     Canon Laser Shot LBP-B406S/D/E, A404E, A304E
     47     Dataproducts BP2000 Line Printer
     48     Dataproducts LZR 2665 Laser Printer
     49     Hewlett-Packard LaserJet II
     50     Hewlett-Packard LaserJet III
     51     Hewlett-Packard LaserJet IIISi
     52     Hewlett-Packard LaserJet 4
     53     OKI MICROLINE 801PS
     54     Printronix P9012 Line Printer
     55     Plotter
     56     PostScript Printer
     57     Bull PR-88
     58     ASCII printer
     59     Bull Compuprint Pagemaster 201 in HP-II Mode
     60     Bull Compuprint Pagemaster 411 in HP-II Mode

Enter number from list above (press Enter to terminate):  ->  51

After choosing number 51 we get the following:


Hewlett-Packard LaserJet IIISi

Header pages wanted?  (n=none; a=each file; g=each job):  -> (n)
Trailer pages wanted? (n=none; a=each file; g=each job):  -> (n)
NOTE:   The hplj-3si printer supports multiple print data streams.
        Each of the data streams will now be configured individually.
--------------------  PostScript  --------------------
Enter print queue name (or, ! to bypass configuration):   -> (ps)
Should this queue be the default queue? -> (y)  n
hplj-3si (PostScript) configured for print queue ps
--------------------  PCL  --------------------
Enter print queue name (or, ! to bypass configuration):   -> (pcl)
Should this queue be the default queue? -> (y)  y
hplj-3si (PCL) configured for print queue pcl

Press Enter to continue.

Thus we created two queues, one for the PostScript data stream, and one for PCL. The PCL queue was made the default queue, and no header or trailer pages were configured for this printer.

Our /etc/qconfig file looks like:

pcl:
        device = hp@p2410l3si
hp@p2410l3si:
        file = /var/spool/lpd/pio/dev/hp@p2410l3si
        header = never
        trailer = never
        backend = /usr/lib/lpd/pio/etc/piojetd p2410l3si

ps:
        device = hp@p2410l3si
hp@p2410l3si:
        file = /var/spool/lpd/pio/dev/hp@p2410l3si
        header = never
        trailer = never
        backend = /usr/lib/lpd/pio/etc/piojetd p2410l3si

The lpstat command displays:

# lpstat
Queue   Dev   Status    Job Files     User         PP %   Blks  Cp Rnk
------- ----- --------- --- --------- ---------- ---- -- ----- --- ---
pcl     hp@p2 READY
ps      hp@p2 READY

Both queues are for the same network-based printer. At this point you would submit jobs to the appropriate queue, either PCL or PostScript.

AIX Print Commands

Submit print jobs Status print jobs Cancel print jobs
enq enq -A enqenq -x
qprt qchk qcan
lp lpstat lpq
lpr lpq lprm

Queue Management Commands

To bring down the printer but not its queue:

# qadm -D Queue

To bring down the printer and kill all current jobs:

# qadm -K Queue

To kill all current jobs:

# qadm -X Queue

To bring down the entire queuing system, allowing queued jobs to finish before doing so:

# qadm -G Queue

To bring the queuing system back up:

# qadm -U Queue

8.2 HP-UX

The Components of the LP Spooler

The components of the lp spooler are:

Printer Names

When you configure a printer into the lp spooler, you assign it a name that you will use when you later submit print requests. This name is referred to as the printer name. Printer names can contain up to 14 characters, which can be alphanumeric or underscores. The name may or may not be the same as the device file name. Some correspondence between the printer name and device file name is suggested. The printer name is the name of the printer that shows up when you request the status of the printer queue with the lpstat command.

A hypothetical system hypo1 has the following printers defined in its lp spooler. The printers have the following names:

laser1
laser2
phred
letterhead
invoices
check_printer

Printer Classes

You can treat a group of printers as if they were one printer. A printer class is a name that you can use to refer to the group of printers. When submitting a print request you can specify a particular printer name or a printer class name. When submitting a print request to a printer class, the print requests will print on the first available printer in the group rather than on a specific printer. Printers that are members of a printer class can still be referenced individually. Creating a printer class is optional.

On the hypothetical system hypo1, three of the printers are grouped into a printer class called laser.

Printer class:  laser
laser1
laser2
phred

Printer class names can contain up to 14 characters, which can be alphanumeric or underscores.

Printer class names and printer names on the same system cannot be the same name. Printer names and class names must all be unique.

Printer classes cannot include remote printers.

A printer class must contain at least one printer.

A printer can only belong to one printer class at a time.

To remove a printer from a printer class, you must remove the printer from the lp spooler and re-add without specifying a printer class

Print Destinations

Several of the commands for the lp spooler require you to specify a print destination. A destination is the name of a printer or printer class.

For our example system hypo1, possible destinations are:

Printer class:  laser
laser1
laser2
phred
invoices
check_printer
letterhead

System Default Printer (Destination)

You can appoint one of the print destinations in your lp spooler to be the system default printer. It is not necessary to have a system default printer, but it is recommended. A system default printer receives any print requests that are not sent to a specific print destination. You can have only one system default printer.

In addition to, or instead of, a system default printer, you can assign each user a default printer to use. To do this, simply set the user's LPDEST shell environment variable to the name of the system default printer. If LPDEST is set and a user does not specify a different printer to use, the printer referenced by LPDEST will be used. If LPDEST is not set for a user, and the user does not specify a printer, the system default printer (if one is set) will be used. If neither LPDEST or the system default printer is set, a user must specify a printer (or printer class).

Printer Interfaces

A printer interface, also known as an interface script, is the final stage of the lp spooler. It is the part of the lp spooler that is responsible for sending data to a printer. Each printer that you have defined for use by the lp spooler has its own interface script (shell script) that resides in the /usr/spool/lp/interface directory. When printers are added to the lp spooler, an interface script is copied from /usr/spool/lp/model to /usr/spool/lp/interface and given the printer name.

If we were to list the directory /usr/spool/lp/interface on our hypothetical system "hypo1," it would contain the printer interface files laser1, laser2, phred, letterhead, invoices, and check_printer.

The entry for the class name laser would be located in the directory /usr/spool/lp/class; it would not be found in the interface directory.

Printer Models

There are printer interface script "models" you can choose from that have been created for you in the /usr/spool/lp/model directory. Many of them have names that match the model numbers of Hewlett-Packard Printers and Plotters.

When you configure your printer into the lp spooler, you must specify which printer model interface script you want to use. The model will be automatically copied from the /usr/spool/lp/model directory into the /usr/spool/lp/interface directory and given the name that you specified as your printer name.

If you list the /usr/spool/lp/model directory, it should look similar to this:

HPGL1          draftpro       hp2560         hp2932a        hp7596a
HPGL2          dumb           hp2563a        hp2934a        laserjet
PCL1           dumbplot       hp2564b        hp33440a       laserjetIIIS
PCL2           fonts          hp2565a        hp33447a       paintjet
PCL3           hp2225a        hp2566b        hp3630a        quietjet
PCL4           hp2225d        hp2567b        hp7440a        rmodel
PRINT3K.model  hp2227a        hp2631g        hp7475a        rmttroff
bf_remote      hp2228a        hp2684a        hp7550a        ruggedwriter
colorpro       hp2235a        hp2686a        hp7570a        thinkjet
deskjet        hp2276a        hp2686a.pif    hp7595a

If you have an HP printer, you will probably find a model script that matches its model number or name. Those interface model scripts that match your printers typically do not need to be changed. If you know how to do shell programming, you can customize printer interface model scripts to meet your specific printing needs.

If you do not have an HP printer, try using the dumb interface model. You might have to modify it to be able to use all of the features of your non-HP printer, but "dumb" should work for basic ASCII text printing. If the dumb printer interface model script does not work, contact your printer supplier for a UNIX line printer spooler interface script or try the script that most closely matches your non-HP printer type.

Device Files

Device files are not part of the lp spooler; they are special files that define the necessary device driver and hardware address needed to communicate with a particular physical device (in this case a printer). The printer name referred to by the lp spooler and the name of the device file for a printer are not required to be the same, but a correspondence is recommended.

You can create printer device files using SAM or HP-UX commands when you add a printer to the lp spooler. SAM creates a device file for you. If necessary, SAM can override the default device file naming convention.

When you configure a printer into your lp spooler, you must supply the name of your printer's device file.

Line Printer Scheduler

The line printer scheduler is the heart of the lp spooler. It is the part of the lp spooler that prevents intermixed listings (output from more than one print request mixed together on a printed page) and controls flow of print requests to the printers. Its duties also include monitoring printer and print request priorities, monitoring/adjusting printer status, and logging lp spooler activities. The lpsched command starts the lp spooler. Because of the central role it plays, starting lpsched is referred to as "starting the lp spooler", and stopping lpsched is often referred to as "stopping the lp spooler." You can use the lpsched command directly or through SAM.

Local Printer

A local printer is a printer that is physically connected to your system.

Remote Printer

A remote printer is a printer that is not physically connected to your system, but can be accessed by your system through a local area network (LAN). To configure a remote printer into your local lp spooler, you must be able to access the remote system via a LAN. The process of adding a remote printer is similar to that of adding a local printer, though you will need to supply some slightly different information.

Network-Based Printer/Plotter

A network-based printer or plotter is connected directly to the local area network (LAN). A network-based printer or plotter is not physically connected to any system.

Print Request Identification Number

When you submit a print request by means of the lp command, lp responds with a print request identification number consisting of the name of the printer (or printer class) followed by a number. Here are some examples of typical print request identification numbers:

 laser-3456
 phred-2152
 letterhead-1547

Remote Spooling

If you have several systems connected to a Local Area Network (LAN) and would like the systems to share the use of a printer, you can set up the lp spoolers of the systems that are not physically connected to the printer to automatically send their print requests (via the LAN) to the lp spooler of the system that does have the printer. The systems without printers act as though they were a user on the system with the printer, submitting print requests to that system's lp spooler. This is accomplished by a special program known as the Remote Spooling Daemon (rlpdaemon).

The rlpdaemon program runs in the background (on the system with the printer) monitoring the incoming LAN traffic for any remote print requests from other systems. When these requests arrive, the rlpdaemon program submits them to its local lp spooler on behalf of the remote user. In addition to remote print requests, the remote spooling daemon must also handle "cancel" and "status" requests from remote systems.

There are special "interface scripts" on the remote systems that issue cancel and status requests. These special interface scripts have a lot in common with printer interface scripts. They have a model directory that can hold sample versions of these scripts, and they have an interface directory where the scripts currently in use reside. The cancel and status models are copied into their respective interface directories automatically when adding a remote printer.

The directory /usr/spool/lp/cmodel contains a sample interface script, rcmodel, that sends a remote cancel command to the system with the printer. When you configure a remote printer into your lp spooler, the cancel model script is copied into the /usr/spool/lp/cinterface directory and is given the same name as the printer.

The directory /usr/spool/lp/smodel contains a sample of an interface script, called rsmodel, which sends a remote status command to the system with the printer. When you configure a remote printer into your lp spooler, the status model script is copied into the /usr/spool/lp/sinterface directory and is given the same name as the printer.

It is unlikely that you will need to customize the remote cancel and status model scripts. If you do customize these "remote control" scripts, you must copy them to a different file name to avoid destroying your changes when updating the system with the update utility.

Configuring a remote printer into your lp spooler requires additional information beyond what is needed to configure a local printer. In addition to the information you normally supply when configuring a local printer into your lp spooler, you will need to tell your system:

Setting Up the LP Spooler Using SAM

Adding a Local Printer

  1. Physically connect the printer(s) to your system. Refer to the instructions shipped with your printer. You should always shut down your system and turn off the power when you are changing the hardware configuration of your system.
  2. Gather the following information:
  3. Run SAM.
  4. Highlight Peripheral Devices and activate the Open control button.
  5. Highlight Printers and Plotters and activate the Open control button.
  6. Highlight Printers/Plotters and activate the Open control button.
  7. Choose Add a Local Printer/Plotter > and the menu item associated with the printer interface type from the Actions menu.

    NOTE: The printer driver must be part of the kernel to add the printer to the lp spooler. If the printer driver is not currently configured into the kernel, SAM prompts you to add the driver(s) and reboot the system.

  8. Highlight the interface to which you connected the printer and fill in and additional information (port number or bus address) and activate the OK control button. If an interface entry is not listed, activate the Diagnose Missing Card control button.
  9. Fill in the printer interface dialog box fields, choose from the menu button values, and turn on and off check box values.
  10. Activate the OK control button.

Adding a Remote Printer

  1. Ensure that the remote system has the printer installed and configured into the remote system's line printer spooler system. Gather the following information:
  2. The name you are giving to this printer or plotter.
  3. Run SAM
  4. Highlight Peripheral Devices and activate the Open control button.
  5. Highlight Printers and Plotters and activate the Open control button.
  6. Highlight Printers/Plotters and activate the Open control button.
  7. Choose Add a remote printer/plotter > and the menu item associated with the printer interface type from the Actions menu.
  8. Fill in the printer interface dialog box fields and turn on off check box values.
  9. Activate the OK control button.

To configure a remote printer into your lp spooler, you must be able to access the system with the printer via a local area network (LAN). The process of adding a remote printer is similar to that of adding a local printer, though you will need to supply SAM with some slightly different information.

Remote printers cannot be members of a printer class.

Adding a Network-Based Printer

To add a network-based printer or plotter using SAM:

  1. Ensure that the printer is connected to the network according to the installation instructions shipped with the network-based printer or the network interface card for the printer.
  2. Gather the following information:
  3. Run SAM
  4. Highlight Peripheral Devices and activate the Open control button.
  5. Highlight Printers and Plotters and activate the Open control button.
  6. Highlight Printers/Plotters and activate the Open control button.
  7. Choose Add a network-based printer then Add TCP-IP protocol printer... from the Actions menu.
  8. Fill in the printer interface dialog box fields and turn on and off check box values.
  9. Activate the OK control button.

Starting and Stopping the LP Spooler

To start the lp spooler:

  1. Run SAM.
  2. Highlight Peripheral Devices and activate the Open control button.
  3. Highlight Printers and Plotters and activate the Open control button.
  4. Highlight Printers/Plotters and activate the Open control button.
  5. Choose Start up printer spooler from the Actions menu.

To stop the LP spooler:

  1. Run SAM.
  2. Highlight Peripheral Devices and activate the Open control button.
  3. Highlight Printers and Plotters and activate the Open control button.
  4. Highlight Printers/Plotters and activate the Open control button.
  5. Choose Shut down printer spooler from the Actions menu.

Determining the Status of the LP Spooler

To determine the status of the lp spooler:

  1. Run SAM.
  2. Highlight Peripheral Devices and activate the Open control button.
  3. Highlight Printers and Plotters and activate the Open control button.
  4. Highlight Printers/Plotters and activate the Open control button.
  5. The status area of the object list will display the status of the scheduler as Scheduler: RUNNING or Scheduler: STOPPED.

Disabling a Printer

  1. Run SAM.
  2. Highlight Peripheral Devices and activate the Open control button.
  3. Highlight Printers and Plotters and activate the Open control button.
  4. Highlight Printers/Plotters and activate the Open control button.
  5. Highlight the printer you want to disable in the object list.
  6. Choose Disable printer from the Actions menu.

NOTE: When you use SAM to "enable" or "disable" a printer, SAM performs both the accept/reject operation and the enable/disable operation. If you wish to "disable" a printer but still accept requests for that printer (letting them accumulate in the request directory for the printer), you must use the HP-UX commands method to disable the printer.

Enabling a Printer

To enable a printer using SAM:

  1. Run SAM.
  2. Highlight Peripheral Devices and activate the Open control button.
  3. Highlight Printers and Plotters and activate the Open control button.
  4. Highlight Printers/Plotters and activate the Open control button.
  5. Highlight the printer you want to enable in the object list.
  6. Choose Enable printer from the Actions menu.

Setting Up the LP Spooler Using HP-UX Commands

Adding a Local Printer

To add a local printer using HP-UX commands:

  1. Ensure that you have superuser capabilities.
  2. Ensure the printer driver is in the kernel.
  3. Ensure a device file exists for the printer.
  4. Stop the lp spooler with the lpshut command:

    # /usr/lib/lpshut

Add the printer to the lp spooler with the lpadmin command. There is an example later in this section. The command has the following basic syntax:

/usr/lib/lpadmin -ppname -vdevfile -mmodel [-d]

where pname is the name that you use to refer to this printer when using the various lp spooler commands, devfile is the name of the device file to be used to communicate with this printer, model is the script you would like to "model" your printer's interface script after. The lpadmin command will make a copy of this model script and place it in the directory /usr/spool/lp/interface, with the name you specified in the -p option described above. -d specifies that you want this printer to be the system default printer.

When using the lpadmin command, do not put any spaces between the options and their respective values.

Allow print requests to enter the request directory for the newly added printer with the accept command:

/usr/lib/accept pname

where pname is the name you gave to this printer in the lpadmin command.

Enable the newly added printer to process print requests with the enable command:

/usr/bin/enable pname

Start the line printer scheduler with the lpsched command:

/usr/lib/lpsched

Examples

To determine the status of the lp spooler:

# /usr/bin/lpstat -r
scheduler is running

To stop the lp spooler:

# /usr/lib/lpshut

To add two printers named invoices and check_printer to the lp spooler:

# /usr/lib/lpadmin -pinvoices -v/dev/ivprint -mhp2934a
# /usr/lib/lpadmin -pcheck_printer -v/dev/ckprint -mhp2564b -g7

To enable the print request directories to accept printer requests:

# /usr/lib/accept invoices
# /usr/lib/accept check_printer
# /usr/lib/accept newclass

To permit the printers to process print requests:

# /usr/bin/enable invoices
# /usr/bin/enable check_printer

To restart the lp spooler:

# /usr/lib/lpsched

Adding a Remote Printer

To add a remote printer using HP-UX commands:

  1. Ensure that you have superuser capabilities.
  2. Stop the lp spooler with the lpshut command:

    # /usr/lib/lpshut

  3. Add the printer to the lp spooler using the lpadmin command:

    # /usr/lib/lpadmin -ppname -vdevfile -mmodel [-d] [-ocmcmodel]\ [-osmsmodel] [-ormremsys] [-orprpname] [-ob3] [-orc]

where pname is the name that you will use to send print requests to this printer. For devfile, since the printer is not physically connected to your local system, use the /dev/null device file. model is the remote model script /usr/spool/lp/model/rmodel. A copy of this file will be put in the /usr/spool/interface directory with the name you specified in pname. -d specifies that you want this printer to be the system default printer. cmodel is /usr/spool/lp/cmodel/rcmodel, used to forward a "cancel" request over to the remote system's lp spooler. The lp spooler copies /usr/spool/lp/cmodel/rcmodel to the /usr/spool/lp/cinterface directory with the name you specified in pname. smodel is the status model script /usr/spool/lp/smodel/rsmodel, used to forward a "status" request over to the remote system's lp spooler. The lp spooler copies /usr/spool/lp/smodel/rsmodel to the /usr/spool/lp/sinterface directory with the name you specified in pname. remsys is the name of the remote system to which the printer is physically connected. rpname is the printer name as it is defined on the remote system.

Allow print requests to enter the request directory for the newly added remote printer with the accept command:

# /usr/lib/accept pname

Enable the newly added remote printer to process print requests with the enable command:

# /usr/bin/enable pname

Start the line printer scheduler with the lpsched command:

# /usr/lib/lpsched

You only need to use the -ob3 option if your print request will be printed on or pass through a system that uses the Berkeley Software Distribution (BSD) style lp spooler. BSD systems use three-digit (rather than four-digit) print request-ID numbers (these are the numbers returned when you send something to print). The -ob3 option disables any lp -oparm options. BSD systems do not understand the -o option to the lp command.

Use the -orc if you want to restrict users to canceling only their own print requests.

Examples

To determine the lp spooler status:

# /usr/bin/lpstat -r
scheduler is stopped

To add a remote printer, referred to locally as letterhead, physically connected to the system hypo2 that uses the BSD style print request-ID numbers, and is known on the remote system as "memos":

# /usr/lib/lpadmin -pletterhead -v/dev/null -mrmodel -ocmrcmodel \
-osmrsmodel -ormhypo2 -ob3 -orpmemos

To add a remote printer, referred to locally as remote_drafts, physically connect to the system system13, known on the remote system as old_reliable, and requires a printer priority of 3:

# /usr/lib/lpadmin -premote_drafts -v/dev/null -mrmodel -ocmrcmodel \
-osmrsmodel -ormsystem13 -g3 -orpold_reliable

To allow print requests to enter the request directory for the newly added remote printers:

# /usr/lib/accept letterhead
# /usr/lib/accept remote_drafts

To enable the newly added remote printers:

# /usr/bin/enable letterhead
# /usr/bin/enable remote_drafts

To start the line printer scheduler, type:

# /usr/lib/lpsched

Adding a Network-Based Printer

To add a network-based printer or plotter using HP-UX commands, follow the instructions shipped with the network-based printer or the network interface card for the printer.

The software needed to configure your network-based printer is shipped separately. Follow the instructions shipped with your printer to load the software and configure the printer.

Accepting and Rejecting Print Requests for a Printer

To accept print requests for a printer or printer class, use the accept command:

# /usr/lib/accept name

You can issue individual commands for each printer class or you can combine the printer classes in one command.

To reject print requests for a printer or printer class, use the reject command:

# /usr/lib/reject [-r"message"] name [-r"message"] [name]

where message is a message to be displayed when users obtain status information about the printer or printer class, name is the name of the printer or printer class whose request directory is being prohibited from receiving print requests.

Examples

To accept print requests for the laser1, laser2, phred, invoices, check_printer printers and the laser printer class:

# /usr/lib/accept laser1
# /usr/lib/accept phred
# /usr/lib/accept invoices laser2 check_printer laser

To reject print requests for the laser1, laser2, phred, invoices, check_printer printers and the laser printer class:

# /usr/lib/reject -r"Printer on loan to seismology lab." laser1
# /usr/lib/reject -r"Printers being serviced" laser1 check_printer
# /usr/lib/reject -r"Invoice forms on order" invoices \
-r "printers are being serviced" laser1 laser2 phred laser

Enabling or Disabling a Printer

To enable a printer to process print requests, use the enable command:

# /usr/bin/enable pname

You can issue individual commands for each printer or you can combine the printers in one command separated by spaces.

To disable a printer to process print requests, use the disable command:

# /usr/bin/disable [-r"message"] pname [-r"message"] [pname]

Examples

To enable the check_printer, laser1, laser2, and phred printers:

# /usr/bin/enable check_printer
# /usr/bin/enable laser1 laser2 phred

To disable the check_printer, invoices, phred, letterhead, and laser printers:

# /usr/bin/disable check_printer
# /usr/bin/disable invoices phred letterhead
# /usr/bin/disable -r "printer disabled to change paper" laser1

Starting and Stopping the LP Spooler

To start the lp spooler, use the lpsched command:

# /usr/lib/lpsched

To stop the lp spooler, use the lpshut command:

# /usr/lib/lpshut

Canceling Print Requests

To cancel print requests, use the cancel command:

# /usr/bin/cancel req-ID [printer]

where req-ID is the print request identification number, and printer is the printer name.

To list print request identification numbers, use the lpstat command.

The cancel command has several useful options that allow you to do things such as cancel all print requests that you have submitted or cancel all requests associated with a particular printer or printer class. Here are a few helpful cancel options and their descriptions:
-aRemove all requests a user owns on the specific printer. The owner is determined by the user's login name and host name on the machine where the lp command was invoked
-eEmpty the spool queue of all requests for the specified printer. Only users with superuser capabilities can use the -e option
-iCancel only local requests.
-u user Remove any requests queued belonging to user. Multiple -u options are allowed. Only users with superuser capabilities can use the -u option.

Examples
# cancel laser-3456
# cancel phred-2152
# cancel letterhead-1547
# cancel laser-3456 phred-2152 letterhead-1547

Viewing the Status of Printers and Print Requests

To view the status of printers and print requests, use the lpstat command:

# /usr/bin/lpstat [-t]

If no options are given, lpstat displays the status of all requests made by the user. The -t option lists the following additional information:

8.3 Interplatform Printing

AIX can print to an HP-UX print server and vice versa. For this to work you must verify the following:

  1. Basic network connectivity between the workstations
  2. Each print server has the appropriate entries in either /etc/hosts.equiv or /etc/hosts.lpd.
  3. For the queue of the AIX client printing to an HP-UX print server, use the following for filters in /etc/qconfig:

    /usr/lpd/attshort
    /usr/lpd/attlong

  4. For printing from and HP-UX client to an AIX print server, be sure to choose the BSD option when adding a remote printer using SAM.

Footnotes:
[8]: InfoExplorer, Queuing System Overview for System Management. HP-UX defines a queue as a directory used by the lp spooler to hold print jobs for each print destination until they can be printed. Thus the concept of queue is quite different.

[9]: InfoExplorer, Printer Overview for System Management


[Next Chapter: 9. Configuring TCP/IP]


Provide feedback to: alan_roberts@hp.com

[Table of Contents] [Outline] [Index] (Updated 09 MAR 97)
Copyright 1996 Hewlett-Packard Company. All rights reserved.