Summary: Remote Printing

meyer at unizh.UUCP meyer at unizh.UUCP
Wed Nov 2 18:24:56 AEST 1988


Hello,

This is a summary of the replies to my inquiry of how to do remote
printing.  With the help of Kevin Perry <perry%phoenix at princeton.edu>
and Brent Bates <blbates at aero4.larc.nasa.gov> I managed it to install
everything necessary for using the laserwriter on our Vax in less than
an hour. The manual page you have to find is mknetpr(1M) (4D Series
Manuals). It will create a shell script
/usr/spool/lp/interface/"printername" which will be executed by lp(1)
if you give "printername" as the destination. If the remote system is
not SYS V you have to adapt the shell script.

Diana Choi <choi at prandtl.nas.nasa.gov> ported the BSD lpr to the Iris
which is a much better solution since lprm would work correctly.
(assuming you port these commands, too). One problem with the SYS V
solution (mknetpr) is that the files in the queue of the remote system
belong to the user lp.  Thus, only lp is allowed to lprm.

Below are the various replies and a diff to show the changes I made.

Thanks to everybody.

Urs

------
From: cernvax!mcvax!aero4.larc.nasa.gov!blbates at unizh.UUCP (Brent Bates TAD/ACB ms294 x2601)
Date: Fri, 28 Oct 88 07:55:23 EDT
Subject: Re:  remote printing

     That is real fun.  We have an IRIS 3130, but I think the process is the
same.  Our IRIS Owner's Guide has a section on installing a remote printer.
Your manuals should also have a similar section, but I'll give you a brief
idea what ours says.  In /usr/spool/lp/etc/util there are a few printer
utilities.  I executed the script mknetpr to get things started.  This script
sets up various files and lpadmin stuff.  One of the files modified, 
/usr/spool/lp/etc/lib/netprinterface, is change and moved to
/usr/spool/lp/interface directory.  This file is the interface between your
Iris and the remote printer.  It basically rcp's the file to be printed to
scratch space on the remote machine, then rsh's a command on the remote machine 
to have the file printed.  Isn't System V printer handling fun!?  Give me
BSD any day.  I have yet to find anything in V that is better than BSD.
AT&T needs to make their Unix more like BSD.
     If you have any more questions just ask.

------
From: cernvax!mcvax!princeton.edu!perry at unizh.UUCP
Date: Thu, 27 Oct 88 15:18:24 EDT
Subject: Re:  remote printing

To define a network printer for lpsched, one runs the script
/usr/spool/lp/etc/util/mknetpr, giving it as arguments
the name of the remote host, local name for printer, and remote 
printer name.  See the comments in "mknetpr" for details.
Mknetpr is a shell script which does a bunch
of things, including creating a file /usr/spool/lp/interface/name_of_printer
which contains a shell script to do remote printing.
Basically, the interface script rcp's your file to the remote host,
then does an "rsh hostname lp".  You will need to hack this
a bit to get it to work, as it expects to talk to a SYS V
system, not BSD, i.e., you want it to "rsh hostname lpr",
and you may want to fiddle with which arguments to lpr it passes
along.  I have ours passing the line:

printit="(cd /tmp ; /usr/ucb/lpr -P$printer -C$host $opts -s -r
-J\"$remtitle\" -\#$copies $fsent )"

with valid "$opts" options being -[cgdnprtv].
(the interface executes this as "$rsh $host $printit",
after setting up all these variables).

Then all that's left is to make a userid named "lp" on the VAX,
which has a .rhosts file allowing remote shell from the 4D.

Oh yeah, last thing...the mknetpr script attempts to check
whether the network is usable before doing the installation
(overkill if you ask me).  This involves attempting an rsh
to the remote machine which is doomed to fail unless VAX-user "lp"
also allows rsh by root at 4D.  Either set the VAX up to allow that
before doing the installation, or just comment out those lines
in mknetpr.

kevin perry
sys prog.
Princeton Univ. CIT/ICGL

perry%phoenix at princeton.edu

------
From: Diana Choi <cernvax!mcvax!prandtl.nas.nasa.gov!choi at unizh.UUCP>
Date: Thu, 27 Oct 88 12:35:04 PDT
Subject: remote printing

    Hi.  I would port the BSD version of lpr to your IRIS.  (I'm assuming
that your vax runs BSD unix).  Otherwise you will have to port lpr to it too.
Anyway the port is not too dificult - I did it and it didn't take too long.
I would love to give you the code but they are very picky about sending
code out of the U.S.  In any event the port is easy.

    So, once you have done the port all you have to do is on the Iris:

     put "rm=foo"  if your vax's name is foo and lpd will know to send the
file to "foo".

			diana
------

% cd /usr/spool/lp/etc/util
% mknetpr lw gorgo lw
% cd /usr/spool/lp/interface
...
% diff lw lw.old
26d25
< TMP=/tmp
43,49c42,48
< #for opt in $options
< #    do
< #        case $opt in
< #	    erase)	erase=$j;;
< #	    *)	    opts="$opts -o$opt" ;;
< #        esac
< #    done
---
> for opt in $options
>     do
>         case $opt in
> 	    erase)	erase=$j;;
> 	    *)	    opts="$opts -o$opt" ;;
>         esac
>     done
53c52
< 	remtitle="${remtitle}_`basename $firstfile`"
---
> 	remtitle="$remtitle `basename $firstfile`"
55c54
< 	remtitle="${remtitle}_$title"
---
> 	remtitle="$remtitle $title"
83c82
< 	until $rcpy $file $rmhost:$TMP/$thisfile
---
> 	until $rcpy $file $rmhost:/usr/tmp/$thisfile
95,96c94,95
< printit="(cd $TMP ; /usr/local/bin/lpr -P$printer -C$host $opts -s -r \
< -J\"$remtitle\" -\#$copies $fsent )"
---
> printit="(cd /usr/tmp ; lp -d$printer -oerase -t\"$remtitle\" -n$copies \
> $opts $fsent )"
102c101
< 	    err="$printer's machine, \"$host\", doesn't execute lpr"
---
> 	    err="$printer's machine, \"$host\", doesn't execute lp"



More information about the Comp.sys.sgi mailing list