steve@pmday_2.Dayton.NCR.COM (Steve Bridges) (02/02/90)
In article <LARRY.90Jan31115055@focsys.uucp> larry@focsys.uucp (Larry Williamson) writes: > > text deleted about remote spooling...... We had a similiar problem here. We are using Expanded Towernet (a version of Xerox's XNS) to go between Towers. One unfortunate problem is that the version of Towernet for our 32/800 supports remote printing to either an lpr printer or lp printer on any machine on the network through either nprint or lprint. However, the version of Towernet for our 32/650 only supports remote spooling to an lpr printer. We have a laser on our 32/800 connected via lp, but our users on the 32/650 were unable to remote print to it. To solve it, I wrote a shell script that emulates the lprint command. It is attached below. There is some HP Laserjet specific escape sequences in the script, so you might want to edit those out. I'm sure it could be adapted to use TCP/IP commands. Another note is that the send and rx commands use an account name of test. This is because of an quirk in Towernet where remote execute and send commands require the use of a valid account name. Well, here is the script.................... -----------------------------cut here---------------------------------- # lprint command for TOWER XP, 32/4X0, 32/6X0 # format of command is lprint sysname printer name files(s) # all entries are required # if used as a pipe, format is some_command | lprint machine printername # # # for example, the command line version is lprint 800 -dp2 /etc/inittab # # This will print the file /etc/inittab on the machine known on the # ethernet network as 800, on the printer called p2 # # # The equivalent pipe version is cat /etc/inittab | lprint 800 -dp2 # # This will take the standard output from the cat command, build a # temporary file on disk, then send it to the remote machine, # and remote execute the lp command, and then remove the work files # # # Modifications: # # 04/03/89: Modifed command line mode to accept fully qualified path # names of files to remote print # Steve Bridges # USDPG Product Marketing and Support OLS ### set up temporary variables since if on pipe mode, 2 shifts ### will cause them to be lost ### the 2 variables are for the remote machine and printer # machine=$1 printer=$2 # stick in proper banner page ####################### LEAD BANNER ################################### echo "\n\n\n" > /tmp/temp$$ echo "6436-0201----------------------------------------------" >> /tmp/temp$$ echo "\n\n\n\n\n\n\n" >> /tmp/temp$$ echo "\n" >> /tmp/temp$$ # # get login name # username=`who am i | cut -c1-8` user=`grep $username /etc/passwd | cut -d: -f5` banner $username >> /tmp/temp$$ echo "\n\n\n" >> /tmp/temp$$ echo >> /tmp/temp$$ echo "Remote print from Product Marketing Tower 32/650" >> /tmp/temp$$ echo " \n\n" >> /tmp/temp$$ if [ -n "$user" ] then echo "User: $user\n" >> /tmp/temp$$ else echo "\n" >> /tmp/temp$$ fi date >> /tmp/temp$$ echo "\n" >> /tmp/temp$$ echo "\014\c" >> /tmp/temp$$ # ### If number of command line arguments is 3, assume command line mode # if [ "$#" -eq 3 ] then cd `dirname $3` /bin/cat `basename $3` >> /tmp/temp$$ send $machine -d /tmp -o test /tmp/temp$$ >/dev/null 2>&1 rx $machine -d /bin -o test chmod 444 /tmp/temp$$ >/dev/null 2>&1 rx $machine -d /usr/bin -o test lp $printer -c /tmp/temp$$ rx $machine -d /bin -o test rm /tmp/temp$$ > /dev/null 2>&1 rm /tmp/temp$$ > /dev/null 2>&1 exit 0 fi # ### If we didn't exit above, assume pipe mode. do 2 shifts ### to retreive file name to print # shift;shift /bin/cat $* >> /tmp/temp$$ send $machine -d /tmp -o test /tmp/temp$$ > /dev/null 2>&1 rx $machine -d /usr/bin -o test lp $printer -c -s /tmp/temp$$ rx $machine -d /bin -o test rm /tmp/temp$$ > /dev/null 2>&1 rm /tmp/temp$$ > /dev/null 2>&1 exit 0 -------------------------cut here----------------------------------------- -- Steve Bridges | NCR - USDPG Product Marketing and Support OLS Steve.Bridges@Dayton.NCR.COM | Phone:(513)-445-4182 622-4182 (Voice Plus) ..!ncrlnk!usglnk!pmday_2!steve | AOPA #916233 ..!uunet!ncrlnk!usglnk!pmday_2!steve| PP-ASEL, AMEL
larry@hcr.uucp (Larry Philps) (02/03/90)
In article <LARRY.90Jan31115055@focsys.uucp> larry@focsys.uucp (Larry Williamson) writes: > >If a user wishes to have a job spooled to a remote printer, we >currently tell them to do something ugly like: > pr file | /usr/ucb/rsh machine_id lp > >They, of course, don't like this. And anyway, they cannot always do >it since some applications when told to print, simply pipe to lp(1). The directory /usr/spool/interface (or whatever, its location changed in SYSV rel 3.2, I can't remember where offhand), contains programs or shell scripts that get called by lpsched to actually print things. So, if your printer is called "laser1", the change the file /usr/spool/interface/laser1 to a script that eventually performs a "rsh machine_id lp arguments". There is a document in the System Administrators Guide that describes the argument conventions for these print filters. The job will get passed from the lp subsystem on one machine to the machine that actually has the printer and will then print. Note that rsh is a crummy command to use for this since in most (all?) implementations it does not return exit codes that reflect the success or failure of the job on the remote system. So, it is quite likely that on occasion jobs will mysteriously evaporate instead of printing. There is no other standard command that will do the job, so you will have to write your own transfer program if this bothers you.
allbery@NCoast.ORG (Brandon S. Allbery) (02/05/90)
As quoted from <LARRY.90Jan31115055@focsys.uucp> by larry@focsys.uucp (Larry Williamson): +--------------- | I suppose I could create a local lp interface program for each remote | printer and do the rsh in it, but that does not seem like the 'right' | thing to do. +--------------- Why not? It's the solution I use, for both rsh/remsh (rsh with a Wollongong accent ;-) and uux(!). It works well and doesn't bypass any necessary lp spooler protocols. It might be possible to put the real /usr/spool/lp directory into its own file system on a single machine, rmount it on the other machines, and make sure /usr/lib/lpsched is running only on the "master" machine; I haven't and can't try it. If it does work, it should be able to print to any printer on any machine in the network, assuming that the "master" rmount's the "slave" machines' root directories; simply tell lpadmin that the printer device is e.g. /r/machine/dev/lp. Of course, such a configuration contains a potential loop, which will be resolved by /r/machine/usr/spool/lp/* pathnames being rejected with EMULTIHOP. If I ever get my hands on a pair of systems which are RFS'ed together, I'll probably try this just to see if it works; it would certainly make network printing easier, although this configuration does break a few things ("lp" will always use "-c", for example, since the chances of a file to be printed living in the /usr/spool/lp filesystem are minimal; on the other hand, I've used a mounted /usr/spool/lp on other systems for other reasons, and the loss of links didn't cause any major problems). Reply to me directly, please; the original poster redirected followups to comp.unix.wizards, which I don't read because it's big and my free time to read news is relatively small. ++Brandon -- Brandon S. Allbery allbery@NCoast.ORG, BALLBERY (MCI Mail), ALLBERY (Delphi) uunet!cwjcc.cwru.edu!ncoast!allbery ncoast!allbery@cwjcc.cwru.edu
john@chinet.chi.il.us (John Mundt) (02/05/90)
In article <855@pmday_2.Dayton.NCR.COM> steve@pmday_2.Dayton.NCR.COM (Steve Bridges) writes: >In article <LARRY.90Jan31115055@focsys.uucp> larry@focsys.uucp (Larry Williamson) writes: >> >> text deleted about remote spooling...... > >We had a similiar problem here. We are using Expanded Towernet (a >version of Xerox's XNS) to go between Towers. One unfortunate problem >is that the version of Towernet for our 32/800 supports remote >printing to either an lpr printer or lp printer on any machine on >the network through either nprint or lprint. I took an even lazier approach. For each remote printer I wanted to have people use, I created a dummy printer on the local machine. Then, I set up the actual printing script (in /usr/spool/lp/admins/lp/interfaces on SysV3.2) and basically changed the line that actually cats the file to the printer device with for file in "$files" do cat $file | uux -n - "${DEST_MACHINE}!lp $REMOTE_PRINTER_NAME -s" done You can do a lot of fancy stuff within the interfaces scripts, since the print spooler really doesn't care what happens to the file once it is shipped off to the script. If you haven't done this often, use the "dumb" printer model and go to work on it. You could even have the file compressed and uncompressed at the other end if large files get printed. -- --------------------- John Mundt Teachers' Aide, Inc. P.O. Box 1666 Highland Park, IL john@admctr.chi.il.us *OR* fred@teacha.chi.il.us (312) 998-5007 (Day voice) || -432-8860 (Answer Mach) && -432-5386 Modem