Setting up your machine to use lpr

There are two separate printing programs on the SGI's, lp which is used by the Desktop and most SGI programs and is the default on an SGI, and lpr, which is usually used from the command line in a shell window and is used by most other Unix systems like Suns and RS/6000's.

The lp program does not normally use the network or talk to remote printers which is why you don`t see it in the Printer Manager. The lpr program was created to use the network and will talk to remote printers on other Unix systems also using lpr.

To use the Desktop to print to remote printers you need to follow the instructions in the other printer document:

lptolpr (Script to pass lp commands to lpr)

This text explains how to configure the use of lpr on an SGI.

The daemon /usr/etc/lpd, should already be running by default if the proper software has been installed. The software is installed from the eoe2.sw.bsdlpr subsystem on 3.3.1 or later versions of IRIX.

Remote printers (lpr):

  1. Edit /etc/printcap and add printer information. See the man page for printcap for more info. If you want to make a printer the default printer for the lpr command add "lp" to the list of printer name aliases. A typical printer entry looks like:

    acc_l1| LaserWriterII, Gilmer B002, ACC:\
          :lp=:rm=jeeves.acc.virginia.edu:rp=acc_l1:\
          :sd=/usr/spool/print/acc_l1:
    

  2. Create the general spool directory and set the correct ownership and permissions:

    	cd /usr/spool
    	mkdir print
    	chown lp print
    	chgrp lp print
    	chmod 755 print
    

  3. Create the spool directory for the new printer and set the correct ownership and permissions (substitute the printer name for name):

    	cd /usr/spool/print
    	mkdir 
    	chown lp 
    	chgrp lp 
    	chmod 775 
    

  4. Reboot (your system) or restart /usr/etc/lpd to get it working.

  5. Make sure the /etc/hosts.lpd file on the remote print servers have your machine name in them.

  6. To print using the command line in a shell window use:

    lpr -Pprinter-name filename 
    

Local Printers (using lpr):

    The SGI's can only communicate with local printers via lp/lpsched, the System V Unix commands, so you must first configure that software using the Printer Manager menu in the System Manager.

    Connect the printer to either the parallel or serial port and configure with the Printer Manager. It's fairly self explanatory. Banner pages are usually turned on by default. To disable them, after adding the printer with the Printer Manager, go to /usr/spool/lp/interface and edit the file that has the printer's name. Change the line "BANNER=1" to "BANNER=0" if it exists.

  1. To use lpr/lpd commands, a script must be installed that will pass the file and lpr commands to lp. Create with an editor, the file /usr/spool/lp/etc/lprtolp, and add the following lines:
    #! /bin/sh
    lp -s -dprinter-name
    

  2. Copy that file to a file with the name of the printer in the same directory. Edit the new file and replace "printer" with the actual printer name. Change file ownership to lp, and make it executable:

    	chown lp filename
    	chmod 755 filename
    

  3. Edit or create /etc/printcap and add printer information. See the man page for "printcap" for more information.

    Modify the following lines:

    	:lp=/dev/null
    	:of=/usr/spool/lp/etc/
    

  4. Replace "printer" with the name of the file which should also be the name of the printer. If you want to make a printer the default printer for the lpr command add "lp" to the list of printer name aliases. A typical local printer entry with the local printer as the default looks like:
    	acc_l1|lp| LaserWriterII, Gilmer B002, ACC:\
    	:lp=/dev/null:sb:sf:sh:\
    	:of=/usr/spool/lp/etc/acc_l1:\
            :sd=/usr/spool/print/acc_l1:
    

  5. Create the general spool directory if it doesn't already exist, and set the correct ownership and permissions:

            cd /usr/spool
            mkdir print
            chown lp print
            chgrp lp print
            chmod 755 print
    

  6. Create the spool directory for the new printer and set the correct ownership and permissions (substitute the printer name for name):

            cd /usr/spool/print
            mkdir name
            chown lp name
            chgrp lp name
            chmod 775 name
    

  7. Edit /etc/hosts.lpd and add the names of all the machines allowed to print to the local printers. If you want to allow any machine to have permission to print just put a "+" in /etc/hosts.lpd.