Using nprint with the Line Printer Daemon

You will recall we previously mentioned that the -c option for the ncpmount is useful for printing. At last we'll explain why and how.

Linux usually uses BSD-style line printer software. The line printer daemon (lpd) is a daemon that checks a local spool directory for queued jobs that are to be printed. lpd reads the printer name and some other parameters from the specially formatted spool file and writes the data to the printer, optionally passing the data through a filter to transform or manipulate it in some way.

The lpd daemon uses a simple database called /etc/printcap to store printer configuration information, including what filters are to be run. lpd usually runs with the permissions of a special system user called lp.

You could configure nprint as a filter for the lpd to use, which allows users of your Linux machine to output directly to remote printers hosted by a NetWare fileserver. To do this, the lp user must be able to write NCP requests to the NCP connection to the server.

An easy way to achieve this without requiring the lp user to establish its own connection and login is to specify lp as the owner of a connection established by another user. A complete example of how to set up the Linux printing system to handle print jobs from clients over NetWare is listed in three steps:

1. Write a wrapper script.

The /etc/printcap file doesn't permit options to be supplied to filters. Therefore, you need to write a short script that invokes the command you want along with its options. The wrapper script could be as simple as:

#!/bin/sh # p2pslaser - simple script to redirect stdin to the

# PSLASER queue on the REDS01 server

#

/usr/bin/nprint -S REDS01 -U stuart -q PSLASER

#

Store the script in the file /usr/local/bin/p2pslaser.

2. Write the /etc/printcap entry.

We'll need to configure the p2pslaser script we created as the output filter in the /etc/printcap. This would look something like:

pslaser|Postscript Laser Printer hosted by NetWare server:

:lp=/dev/null:

:sd=/var/spool/lpd/pslaser:

:if=/usr/local/bin/p2pslaser:

:af=/var/log/lp-acct:

:lf=/var/log/lp-errs:

:pl#66:

:pw#80:

:pc#150:

:mx#0:

:sh:

3. Add the -c option to the ncpmount.

ncpmount -S REDS01… -c lp…

Our local user stuart must specify the lp user as the owner of the connection when he mounts the remote NetWare server.

Now any Linux user may choose to specify pslaser as the printer name when invoking lp. The print job will be sent to the specified NetWare server and spooled for printing.

Managing Print Queues

The pqlist command lists all of the print queues available to you on the specified server. If you do not specify a fileserver on the command line using the -S option, or a login name and password, these will be taken from the default entry in your ~/.nwclient file:

# pqlist -S vbrew_f1 -U guest -n

Server: ALES_F1

Print queue name                                    Queue ID 

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

TEST                                                AA02009E

Q2                                                  EF0200D9

NPI223761_P1                                        DA03007C

Q1                                                  F1060004

I-DATA                                              0D0A003B

NPI223761_P3                                        D80A0031

Our example shows a list of the print queues available to the guest user on the ALES_F1 fileserver.[88]

To view the print jobs on a print queue, use the pqstat command. It takes the print queue name as an argument and lists all of the jobs in that queue. You may optionally supply another argument indicating how many of the jobs in the queue you'd like to list. The following sample output has been compressed a bit to fit the width of this book's page:

$ pqstat -S ALES_F1 NPI223761_P1

Server: ALES_F1     Queue: NPI223761_P1          Queue ID: 6A0E000C

   Seq  Name      Description                    Status   Form  Job ID 

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

     1  TOTRAN    LyX document - proposal.lyx    Active      0  02660001

We can see just one print job in the queue, owned by user TOTRAN. The rest of the options include a description of the job, its status, and its job identifier.

The pqrm command is used to remove print jobs from a specified print queue. To remove the job in the queue we've just obtained the status of, we'd use:

$ pqrm -S ALES_F1 NPI223761_P1 02660001

The command is pretty straightforward but is clumsy to use in a hurry. It would be a worthwhile project to write a basic script to simplify this operation.

NetWare Server Emulation

There are two free software emulators for NetWare fileservers under Linux. lwared was developed by Ales Dryak and mars_nwe was developed by Martin Stover. Both of these packages provide elementary NetWare fileserver emulation under Linux, allowing NetWare clients to mount Linux directories exported as NetWare volumes. While the lwared server is simpler to configure, the mars_nwe server is more fully featured. The installation and configuration of these packages is beyond the scope of this chapter, but both are described in the IPX-HOWTO.

Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату