ECN No Name Newsletter: April, 1994

The ECN No Name Newsletter is no longer being published. This is an archived issue.

[previous article] [next article]

Solaris: Printing Changes

NO NAME NEWSLETTER Article, April 1994

David Curry


The following article is a reprint of a portion of ECN 199-E, Migrating To Solaris And The Common Unix Environment. To obtain a copy of the complete document, please contact your site specialist. The printing system provided with Solaris represents a complete change from the one used on SunOS and other ECN UNIX systems. On SunOS and other ECN UNIX systems, we use the Berkeley Line Printer system, usually referred to as the LPR system. This package includes the lpr, lpq, and lprm commands with which we are all familiar. On Solaris however, we will be using the System V Line Printer system, commonly referred to as LP. The commands provided with the LP system are similar in functionality to those provided by the LPR system, but they have different names and use different command line arguments.

NOTE

At the present time, the ECN staff is providing only minimal support for printing from Solaris. Much of the work done for you by the LPR subsystem, such as converting the output from TROFF or TeX to the appropriate format (the -d and -n options), converting plot output to the appropriate format (with C-g), and interpreting FORTRAN carriage control (the -f option) is not currently done by the LP subsystem. While this does not mean that you cannot print files from Solaris systems, it does mean that for the time being you may have to do a little extra work before sending the job to the printer.

NOTE

At the present time, the ECN staff is supporting printing under Solaris only by setting the Solaris systems up to send output to a printer connected to a non-Solaris system. Although we will eventually support printers directly connected to Solaris systems, this support is not available yet.

Submitting Jobs

To submit a file for printing under Solaris, the general format of the command is:

% lp [-d dest] filename [filenames...]

In this command, filename is the name of the file you want to print, and dest is the name of the printer you want to print it on.

Printers under Solaris have the same names as they do on other ECN systems, so if you wanted to print your file on the Apple LaserWriter in room 104 of the MSEE building, you would issue the command

% lp -d msa filename

Unlike the lpr command, which makes a copy of the file before printing it, lp tries to print the file from its current location in your directory. This has some important implications:

        If you edit  the  file  after  you  have  issued  the  lp
        command,  but  before  it  gets  sent to the printer, the
        changes you make to the file will appear in  the  printed
        copy.

If you delete the file before it gets sent to the printer, it will not get printed at all.

If you print a file from a directory which the line printer subsystem does not have access to due to file permissions, you may receive an error message about the file being inaccessible. If this occurs, you can give the file to lp via the standard input, using a command like: % lp < filename

Generally, this change won't make much difference to you. However, if you have problems printing a file because of this change, you may wish to use the -c option to the lp command, which tells it to make a copy of the file before printing it.

When lp submits a job to be printed, it will provide you with a request id that you can use to refer to the job later. The request id is made up of the printer name and a number which increments with each print job. For example:

% lp -d msa program.c

request id is msa-65 (1 file(s))

Formatting Your Output

The LPR system provides a number of options to format your output appropriately for the printer. These options are not currently supplied by the LP system, meaning that you have to run the format conversions yourself. The following sections provide information about formatting various output types for printing on PostScript printers. If you want to send the output to some other type of printer (e.g., an Imagen), you will probably be better off submitting the job from a system not running Solaris.

Device-Independent Troff

To send your device-independent troff output to a PostScript printer, run the output through the psdit command first: % troff -Tpsc -mmacros filename(s) | psdit | lp -d printer

TeX

To send your TeX output to a PostScript printer, you need to first convert the DVI file to PostScript using the dvips command from /usr/unsup/bin . You can then send the output of dvips to the printer by simply saying

% lp dvips-output-file

Plot Output

To send your plot output to a PostScript printer, run the output through the psplot command first:

% psplot file | lp

Checking the Queue

To check the status of the printer queue in Solaris, you use the lpstat command. There are two options to this command that will be of use to you. The first option, -o, lets you give the name of the printer queue you are interested in. For example:

   % lpstat -o msa
   msa-65     davy       54   Feb  8 12:59 canceled
   msa-66     davy       54   Feb  8 13:00 canceled
   msa-67     davy     2546   Feb  8 13:05
This shows that there are three items in the queue: two of them have been cancelled, and the other is being printed.

The second option, -p, lets you check on the status of the printer itself. For example:

        % lpstat -p msa
        printer msa is idle. enabled since Tue  Jan  26  18:20:03
        EST 1993. available.

Cancelling Jobs

To cancel a job that you have already sent to the printer, use the cancel command. This command takes the request ids given to you by the lp command as arguments (you can also obtain the request ids with the lpstat command described above). For example:

    % cancel msa-67
        request "msa-67" cancelled
You can also cancel all of your print jobs at once by issuing the command

% cancel -u yourlogin

This will cancel all your print jobs on all printers.

Setting Your Default Printer

Under the LPR system, you can specify a default printer by setting the PRINTER environment variable. Under the LP system you can do this as well, except that the variable is called LPDEST . For example, to set your default printer to ``msa'' on Solaris, you would use one of the following commands:

   Bourne/Korn shell (.profile):
             LPDEST=msa
             export LPDEST

   C Shell (.cshrc):
             setenv LPDEST msa

NOTE

Under the LPR system, there is also a default printer for each host, so that when you issue an lpr command with no printer name specified (and no PRINTER variable set in your environment), the output goes ``somewhere'' instead of giving you an error message. At the present time, we have not configured the Solaris systems with default printers (we will do so at some undetermined future date). This means that, for the time being, you must either always use the -d printername option to the lp command, or you must set your LPDEST environment variable.

What Printers Does Your System Know About?

By default, the ECN staff does not configure support for specific printers into each new Solaris system, mostly for technical support reasons. This means that it is unlikely that the printers you use on a regular basis are known by your Solaris system. To find out what printers your system knows about, use the command

% lpstat -p all

This will print a list of printers your system knows about. If there is a printer that you use regularly that is not in the list printed by lpstat, contact your site specialist to have it added. It is not a problem to add a printer; we just don't want to configure in support for 200-plus printers on every Solaris system until we have worked out some of the technical details involved in doing such a thing.


webmaster@ecn.purdue.edu
Last modified: Saturday, 13-Sep-97 02:16:19 EST

[HTML Check] HTML