Chapter 16: Printing remotely over TCP/IP
Table of contents
Chapter 16
Printing remotely over TCP/IP
Remote Line Printing (RLP)
allows UNIX systems on a network to send print jobs to other
UNIX systems that have attached printers.
The only restrictions on the use of RLP are:
-
Printer classes are not supported.
-
Not all line printer command options are supported on the client.
RLP allows print jobs to be submitted from a client and
printed by a print server, but it does not support remote administration
of printers. To administer a printer attached to
a print server, do one of the following:
-
Log in to the print server at the console.
-
Log in to the print server from another machine using terminal emulation.
-
Issue printer administration commands from another machine using
the
rcmd(TC)
command.
How RLP works
RLP operates differently from normal printing.
First, a new file, called
printcap(SFF),
contains information about local
and remote printers and related files needed by the print commands.
Second, the usual SCO system print commands (lp, cancel,
and lpstat) are moved to the directory /usr/lpd/remote
for safekeeping, and new versions of these commands are moved
to /usr/bin. These new commands consult the file
/etc/printcap to determine whether the print job is
going to a local printer or a remote printer attached to a print
server.
If the printer is local, printing occurs just as it would with
the standard command. All standard command options
are supported. This is because the new command simply
invokes the standard command, now located in
/usr/lpd/remote. If the printer is remote, the
command spools the print job and invokes the lpd
daemon. This daemon packages the print job in 4.3BSD
format and sends it
over the network to the host specified in the /etc/printcap
file.
The client/server model
The systems that send
print jobs are called clients. The systems that directly
control the printers are called print servers.
Clients and print servers can be either an SCO system or
a 4.3BSD system (or one of its derivatives, such as
SunOS(TM)).
See also:
Installing and removing RLP
Before installing RLP on your SCO system,
be sure first to install TCP/IP.
To install RLP:
-
Log in as root.
-
Enter:
mkdev rlp
You now see the following display:
Remote printing configuration
Do you want to install or delete remote printing (i/d/q)?
-
You have three options:
-
To install or reinstall RLP, enter i.
Skip to the next step.
-
To remove RLP after it has been installed, enter
d. Once RLP has been removed, your
local printing environment is restored and you are returned to
the shell prompt.
-
To quit and return to the shell prompt, enter q.
-
You now see the following messages:
Installing Remote Line Printing
Creating directories /usr/lpd/remote and /usr/spool/lpd and file /etc/printcap
Saving lp, cancel, lpmove and lpstat commands to /usr/lpd/local
Installing remote lp, cancel, lpmove and lpstat commands
Do you wish to change the remote printer description file /etc/printcap (y/n)?
To define printers available through RLP,
enter y. The rlpconf command is then
executed. See
``Setting up a client''
and
``Setting up a print server''
later in this chapter for information on
rlpconf.
To wait until later to define printers, enter
n. You then see the message:
Run /etc/rlpconf to change the remote printer description file
Remember to run rlpconf at some point before using RLP.
Otherwise, you will have no entries in the
/etc/printcap file.
-
If the directories that RLP needs to do the
installation already exist, you see the following message:
Remote line printing working directory already exists.
Do you wish to continue installing the remote line printing system (y/n)?
Enter y to continue the installation. Enter
n to stop and return to the shell prompt.
-
You are now asked the following question:
Do you want to start remote daemon now (y/n)?
To start the
lpd(ADMN)
daemon, enter y.
This daemon must be running for RLP to work.
To wait until later to start the daemon, enter n.
Manually adding remote printers
To configure a remote printer, execute the rlpconf command. For
more information, refer to the
rlpconf(ADMN)
manual page.
This command
edits the /etc/printcap file for you. The following
example illustrates the use of rlpconf to set up the
sunlaser printer to produce an entry in the
/etc/printcap file like the one shown at the beginning
of this section.
Assuming you are logged in as root, invoke the rlpconf
command. You see output similar to the following:
Remote Printing Configuration
Enter information for remote printers or local printers accepting
remote printing requests
Please enter the printer name (q to quit): sunlaser
Is sunlaser a remote printer or a local printer (r/l)? r
Please enter the name of the remote host that sunlaser is
attached to: ohio
Printer sunlaser is attached to host ohio
Is this correct? (y/n) y
If 'ohio' currently runs SCO OpenServer Release 5 or above,
it can support the extended remote line printer protocol.
Do you want to turn on the "extended RLP protocol" support flag?
If you're not sure, answer 'n'? (y/n) [n]
Would you like this to be the system default printer? (y/n) y
Make sure that your host name appears in ohio's /etc/hosts.equiv
or /etc/hosts.lpd file.
Make sure that sunlaser appears in ohio's /etc/printcap file (BSD format)
Make sure that sunlaser has a spool directory on ohio
Putting sunlaser in printer description file and creating spool dir
Updating LP information...done
Updating /usr/spool/lp/default...done
NOTE:
The extended remote line printer protocol enables users to move print jobs
between printers (that are connected to SCO systems) and enables
the lpstat command to give the status of remote printers.
The above example shows how to configure your client to use a
remote printer called
sunlaser attached to the print server ohio.
After entering the name of the printer and the print server,
you must verify the information just entered.
If it is correct, enter y. If it
is not, enter n, at which point you are asked if
you want to try again. Answer y to be
prompted again for the name of the printer and the print server.
Answer n to exit and return to the shell prompt.
Continuing with the above example, you are asked if you wish to
make the printer the system default.
Answer y or n. If you
answer n, users on the client that wish to route a
print job to sunlaser must do so
explicitly by using the -d option in
the lp command.
Following this query, you are advised to verify certain
things on the print server.
The rlpconf command now checks that the printer is not already
listed in /etc/printcap. If it is, a message to that
effect is displayed.
If it is not, the printer information is added to
/etc/printcap.
In addition, the spool directory for the printer, in this case
/usr/spool/lpd/sunlaser, is created and
configuration information indicating the name of the printer and
the print server is stored in a file
called configuration. This file is located in a subdirectory bearing
the printer's name under /usr/spool/lp/admins/lp/printers.
In this example, the pathname of the file is
/usr/spool/lp/admins/lp/printers/sunlaser/configuration.
Finally, if the printer is to be the system default, the file
/usr/spool/lp/default is updated to contain the name of
the printer.
Once you have configured the printer, the screen
clears and you see output similar to the following:
Remote Printing Configuration
Enter information for remote printers or local printers accepting
print jobs.
Please enter the printer name (q to quit): q
Enter q to exit
rlpconf and return to the shell prompt.
Once you have finished configuring printers,
ensure that the RLP daemon lpd is running.
You can do this by entering the command ps -fe and
verifying that the daemon appears in the listing.
See also:
Deleting printcap entries
To delete an entry in the /etc/printcap file, you must
use your favorite text editor. Be sure to delete the entire
entry, which is continued over two lines. Also, you should
delete the spool directory
/usr/spool/lpd/printer_name
and the file
/usr/spool/lp/admins/lp/printers/printer_name/configuration
associated with the deleted printer. Finally, if the deleted
printer is the system default printer, you should modify the file
/usr/spool/lp/default appropriately. See
``Setting up a client''
earlier in this chapter for more information.
Setting up a client
The printer description file /etc/printcap on the client machine
provides routing and other information about printers.
NOTE:
If the printer to be set up is a local printer, that is, attached
to the client for its private use, you should set it up following
the instructions in
``Setting up a print server''
but ignore instructions regarding the /etc/hosts.equiv and
/etc/hosts.lpd files.
For a full description of the /etc/printcap file
format, see the
printcap(SFF)
manual page.
Here is an example of an entry in the /etc/printcap
file, followed by an explanation of each field. Note that
fields are separated by colons.
laser::lp=:rm=ohio:rp=sunlaser:sd=/usr/spool/lpd/laser
Each of the fields is described below:
-
The first field, laser, is the name
by which the client knows the printer.
For a remote printer, the name that the client uses
need not be the same as that used by the print server.
In this example, laser is an
alias for the printer named sunlaser on ohio.
-
The second field (before the first colon on the second line) is
empty by default.
When used, it defines the name of the error log
file.
-
The third field, starting with lp=, must
be empty
(that is, followed immediately by a colon) for remote printing.
This field specifies the device name for a local printer.
-
The fourth field,
starting with rm=, specifies the network name of the print server.
In this example, the print server is called ohio.
-
The fifth field, starting with rp=,
specifies the name that the print server uses for the
printer.
-
The last field, starting with sd=, is the
name of the spooling directory on the client. It is in this
directory that print jobs are stored
before being sent over the network to the print server.
This directory is always located in /usr/spool/lpd and
bears the name of the printer. In this example, the spool
directory is called /usr/spool/lpd/laser.
See also:
Setting up a print server
NOTE:
If the printer to be set up is a local printer, that is, attached
to the client for its private use, you should set it up following
the instructions
here,
but ignore instructions regarding the /etc/hosts.equiv and
/etc/hosts.lpd files.
To set up a print server to process RLP requests, do the following:
-
Ensure that the RLP daemon lpd is running.
You can do this by entering the command ps -fe and
verifying that the daemon appears in the listing.
-
Ensure that that all printers attached to the print server are
working properly as local printers. See the documentation
that accompanies the operating system running on the print server
for information on how to set up local printer services.
-
List all of the clients that are to have access to the print
server in either the
/etc/hosts.equiv or the /etc/hosts.lpd file
using your favorite text editor.
Listing a client in the latter file is more secure, in that only
remote printer access is granted to the specified client. See
the manual page that describes /etc/hosts.equiv for
information on the kind of access made available to hosts
listed in that file.
-
Execute rlpconf to
create
the /etc/printcap file and
the spool directories for printers attached to the
print server.
Once you invoke rlpconf, you see output similar
to the following:
Remote Printing Configuration
Enter information for remote printers or local printers accepting
print jobs.
Please enter the printer name (q to quit): sunlaser
Is sunlaser a remote printer or a local printer (r/l)? l
Please enter the name of the device for sunlaser: /dev/laser
Printer sunlaser uses device /dev/laser
Is this correct? (y/n) y
Putting sunlaser in printer description file and creating spool
directory...done
First enter the name of a printer
attached to the print server. Next, enter l in response
to the second question to indicate that you are on
a print server. Then, enter the
full pathname for the device
for the printer.
You are now given the opportunity to verify the device filename
for the printer. If it is correct, enter y. If it
is not, enter n, at which point you are asked if
you want to try again. Answer y to start from the
beginning or answer n to exit and return to the shell prompt.
Once you indicate that the device filename is correct,
the rlpconf command checks that the printer is not already
listed in /etc/printcap. If it is, a message to that
effect is displayed.
Otherwise, the printer information is added to
the /etc/printcap file
and the spool directory for the printer,
/usr/spool/lpd/sunlaser, is created.
Once processing
is complete for one printer, you are prompted to set up another printer.
When you are done,
enter q to exit
rlpconf and return to the shell prompt.
See also:
Using RLP
To use RLP, you invoke one of the supported commands.
There are actually two sets of commands: one for SCO clients and
one for 4.3BSD clients and derivatives.
4.3BSD clients
On 4.3BSD clients and derivatives, use the standard printing commands
lpr, lprm, and lpq to do remote printing.
The following options are supported when sending a print job to a
remote printer attached to an SCO system on which RLP
has been installed:
lpr -Pprinter_name [-#number_of_copies] [-Ttitle] [-s]
(The -s option uses symbolic links instead of copying the
file to the spool directory.)
lpq -Pprinter_name
lprm -Pprinter_name
lprm -Pprinter_name job_number
Only the options listed previously are supported for the lpr,
lpq, and lprm commands when used for remote printing.
If unsupported options are specified, they are ignored by the print server
and the print job is submitted without them.
NOTE:
If the remote printer is attached to a print server running 4.3BSD
or a derivative, the above restrictions do not apply. In this
case, both the client and the print server are running 4.3BSD or a
derivative. Remember that RLP is installed only on SCO
systems.
If printing is to be done locally, all of the options that are normally
available for local printing are supported.
SCO clients
On SCO clients, the RLP commands are
lp, lpmove, cancel, and lpstat.
These commands work just like their non-RLP
counterparts when invoked with no
options and when invoked with the following supported options:
- lp -dprinter_name
-
- lp -nnumber_of_copies
-
- lp -ttitle_to_print_on_banner
-
- lp -irequest_id_options
-
modify an earlier print request of a job still in the local queue.
- lp -qpriority_level
-
- lp -L spooler|local|live=<device>
-
local or spooled printing
- lp -T file_type
-
type of input files
- lp -o length=scaled_number
-
page length
- lp -o width=scaled_number
-
page width
- lp -o lpi=scaled_number
-
line pitch
- lp -o cpi=scaled_number
-
character pitch
- lp -o stty='stty_options'
-
port characteristics
- lp -o other_local_options
-
as defined locally
- lp -o nofilebreak
-
no inter-file form feed
- lp -o nobanner
-
no banner page
- lp -m | -w
-
mail/write when done
- lp -H hold
-
hold -- do not print until notified. The print job will remain on the
spool on the local machine instead of going to the remote printer.
Other print requests will go ahead of a held request until it is resumed.
- lp -H immediate
-
print the request next. The printer will attempt to print the job at queue
priority one.
- lp -H resume
-
resume a previously held request.
- lp -c
-
make copies first
- lp -r
-
use no filter
- lp -R
-
remove after spooling
- lp -s
-
no request-id message
- lpstat -aremote_printer_name
-
acceptance status
- lpstat -oremote_printer_name
-
output requests status
- lpstat -premote_printer_name
-
available printers and printer status
- lpstat -p list -D
-
give printer description
- lpstat -vremote_printer_name
-
pathnames of associated devices
- lpstat -c classes
-
show available classes
- lpstat -u users
-
show status of user requests
- lpstat -f forms
-
show available forms
- lpstat -S char_sets,print_wheels
-
show available fonts
- lpstat -d
-
show default destination
- lpstat -l
-
verbose mode
- lpstat -r
-
show status of spooler
- lpstat -s
-
show summary status
- lpstat -t
-
show status of everything
NOTE:
Multiple lp options specified with the -o
option must be strung consecutively within double quotes
and separated by commas. For example,
lp -o "nobanner, length=10" is valid, while
lp -o nobanner -o length=10 is not.
The variable ``all'' is allowed with the
-a, -c, -f, -o, -p,
-S, -u, -v options for
lpstat.
Only the options listed above are supported for the lp
and lpstat commands when used for remote printing.
If one or more unsupported options are specified, they are ignored
and the print job is submitted without them.
If printing is to be done locally, all of the options that are
normally available for local printing are supported.
NOTE:
On an SCO client, you must install RLP before you can
do remote printing. See
``Installing and removing RLP''
earlier in this chapter for more information.
See the
cancel(C),
lp(C),
lpmove(ADM),
and
lpstat(C)
manual pages for more information on the supported options.
For more about remote line printing
To get more information about the line printer daemon protocol,
see the following Request for Comments (RFC).
For information on how to obtain RFCs, see
``Obtaining RFCs from the Internet''.
--------------------------------------------------------------------
RFC Title
--------------------------------------------------------------------
1179 Line Printer Daemon Protocol