[u3b.sources] Printing through UUCP

woods@eci386.uucp (Greg A. Woods) (12/17/90)

In article <11702@ccncsu.ColoState.EDU> hallt@handel.CS.ColoState.Edu (Tim C. Hall) writes:
>     We have two AT&T 3B2 hosts running UUCP.  One has a printer attached,
> and we wish to allow the other host to send print jobs remotely via UUCP.
> How is this best achieved?  Any comments, or, better yet, experiences
> with accomplishing the above feat would be highly appreciated.  Please
> send all replies to thall%spacecom.spacenet-gw.af.mil@server.af.mil
> Thanks for all your help.

No problem.  Here are a couple of handy lp model scripts that I've
used with great success.  To set them up, the "server" (i.e. the
machine with the printer), must have an appropriately configured lp,
and have UUCP permissions for 'lp', and perhaps 'uncompress', made
available to the client machines:

The file remote_mach contains a list of printers and the machines to
which they are attatched.  Lp on all machines should be configured
with the same printer names on all machines.

Note:  I use this with some SysVr3.0 and SysVr3.1 machines (and it
will work on 3b1's too), but I've never had much chance to do anything
like this for SysVr3.2.  I suspect 3.2 has more complex facilities to
do the same thing.

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then feed it
# into a shell via "sh file" or similar.  To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix@uunet.uu.net if you want that tool.
# If this archive is complete, you will see the following message at the end:
#		"End of shell archive."
# Contents:  usr/spool/lp/remote_mach
#   usr/spool/lp/interface/AppleLaser
#   usr/spool/lp/interface/AppleLaserZ
# Wrapped by woods@eci386 on Sun Dec 16 14:14:14 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'usr/spool/lp/remote_mach' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'usr/spool/lp/remote_mach'\"
else
echo shar: Extracting \"'usr/spool/lp/remote_mach'\" \(33 characters\)
sed "s/^X//" >'usr/spool/lp/remote_mach' <<'END_OF_FILE'
XAppleLaser	gate
XAppleLaserZ	gate
END_OF_FILE
if test 33 -ne `wc -c <'usr/spool/lp/remote_mach'`; then
    echo shar: \"'usr/spool/lp/remote_mach'\" unpacked with wrong size!
fi
# end of 'usr/spool/lp/remote_mach'
fi
if test -f 'usr/spool/lp/interface/AppleLaser' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'usr/spool/lp/interface/AppleLaser'\"
else
echo shar: Extracting \"'usr/spool/lp/interface/AppleLaser'\" \(517 characters\)
sed "s/^X//" >'usr/spool/lp/interface/AppleLaser' <<'END_OF_FILE'
X#
X# lp interface for a remote printer
X#
X#
XPATH=/bin:/usr/bin:/usr/lbin:/usr/local/bin ; export PATH
X
XPRINTER=`basename $0`
XTITLE=$3
XCOPIES=$4
XOPTIONS=$5
Xshift; shift; shift; shift; shift
Xfiles="$*"
X
XMACHINE=`mktable /usr/spool/lp/remote_mach | awk '$1~/^'$PRINTER'$/ {print $2}'`
X
Xecho "`date +%D-%T`:$PRINTER:$MACHINE:$RAW:-t$TITLE:-o$OPTIONS:-n$COPIES:$files" >> /usr/spool/lp/remlog
X
Xfor F in $files
Xdo
X	FILES="$FILES !$F"
Xdone
Xuux -n -C "$MACHINE!lp -c -d$PRINTER '-t$TITLE' '-o$OPTIONS' -n$COPIES $FILES"
Xexit 0
END_OF_FILE
if test 517 -ne `wc -c <'usr/spool/lp/interface/AppleLaser'`; then
    echo shar: \"'usr/spool/lp/interface/AppleLaser'\" unpacked with wrong size!
fi
chmod +x 'usr/spool/lp/interface/AppleLaser'
# end of 'usr/spool/lp/interface/AppleLaser'
fi
if test -f 'usr/spool/lp/interface/AppleLaserZ' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'usr/spool/lp/interface/AppleLaserZ'\"
else
echo shar: Extracting \"'usr/spool/lp/interface/AppleLaserZ'\" \(523 characters\)
sed "s/^X//" >'usr/spool/lp/interface/AppleLaserZ' <<'END_OF_FILE'
X#
X# lp interface for a remote printer
X#
X#
XPATH=/bin:/usr/bin:/usr/lbin:/usr/local/bin ; export PATH
X
XPRINTER=`basename $0`
XTITLE=$3
XCOPIES=$4
XOPTIONS=$5
Xshift; shift; shift; shift; shift
Xfiles="$*"
X
XMACHINE=`mktable /usr/spool/lp/remote_mach | awk '$1~/^'$PRINTER'$/ {print $2}'`
X
Xecho "`date +%D-%T`:$PRINTER:$MACHINE:$RAW:-t$TITLE:-o$OPTIONS:-n$COPIES:$files" >> /usr/spool/lp/remlog
X
Xfor F in $files
Xdo
X	uux -n -C "$MACHINE!uncompress < !$F | lp -c -d`basename $PRINTER Z` '-t$TITLE' '-o$OPTIONS' -n$COPIES"
Xdone
Xexit 0
END_OF_FILE
if test 523 -ne `wc -c <'usr/spool/lp/interface/AppleLaserZ'`; then
    echo shar: \"'usr/spool/lp/interface/AppleLaserZ'\" unpacked with wrong size!
fi
chmod +x 'usr/spool/lp/interface/AppleLaserZ'
# end of 'usr/spool/lp/interface/AppleLaserZ'
fi
echo shar: End of shell archive.
exit 0
-- 
							Greg A. Woods
woods@{eci386,gate,robohack,ontmoh,tmsoft}.UUCP		ECI and UniForum Canada
+1-416-443-1734 [h]  +1-416-595-5425 [w]  VE3TCP	Toronto, Ontario CANADA
Political speech and writing are largely the defense of the indefensible-ORWELL