[comp.sys.att] Printing through UUCP

hallt@handel.CS.ColoState.Edu (Tim C. Hall) (12/14/90)

Got a question:
    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.

Tim C. Hall, System Administrator
Air Force Space Command
thall%spacecom.spacenet-gw.af.mil@server.af.mil

cmilono@netcom.UUCP (Carlo Milono) (12/15/90)

I have implemented this using UUX commands; below is a sample command
which can be included in a standard lp/interfaces script, as appropriate.

uux "remote!lp !myfile1"  [this would print myfile on a printer on remote]

Of course, you could use any/all flags to the standard lp command such as
the '-d' option; as shown above, the local file would print on the remote
machine's DEFAULT printer (assuming a default has been chosen!).  You
could also specify options with the '-o', etc.

BTW, the double quotes appear to be necessary...


-- 
+--------------------------------------------------------------------------+
|  Carlo Milono:  netcom!cmilono@apple.com   or   apple!netcom!cmilono     |
|"When a true genius appears in the world, you may know him by this sign,  |
|that the dunces are all in confederacy against him."   - Jonathan Swift   |
+--------------------------------------------------------------------------+

tkevans@fallst.UUCP (Tim Evans) (12/15/90)

In <18809@netcom.UUCP> cmilono@netcom.UUCP (Carlo Milono) writes:

>I have implemented this using UUX commands; below is a sample command
>which can be included in a standard lp/interfaces script, as appropriate.

>uux "remote!lp !myfile1"  [this would print myfile on a printer on remote]

You must also "authorize" the 'lp' command to be executed via uux.  This
involves the /usr/lib/uucp/L.cmds or /usr/lib/uucp/Permissions files
(which depends on which version of UUCP you are running.
-- 
UUCP:		{rutgers|ames|uunet}!mimsy!woodb!fallst!tkevans
INTERNET:	tkevans%fallst@wb3ffv.ampr.org
Tim Evans	2201 Brookhaven Ct, Fallston, MD 21047

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

rad@genco.bungi.com (Bob Daniel) (12/18/90)

In article <11702@ccncsu.ColoState.EDU> hallt@handel.CS.ColoState.Edu (Tim C. Hall) writes:
>
>Got a question:
>    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

There is a remote interface included with 3B1's that shows how it can be done.
The concept is simple.  Just make an interface that redirects the output to
a  file and then uucp the file to the destination.  Then, do a uux on the
remote machine (the calling machine will have to have permission to run
lp remotely which is setup in /usr/lib/uucp/Permissions) to lp the file that
was uucp'd.

norm@cfctech.cfc.com (Norman J. Meluch) (12/19/90)

In article <11702@ccncsu.ColoState.EDU> hallt@handel.CS.ColoState.Edu
(Tim C. Hall) writes:

{T} Got a question:
{T}     We have two AT&T 3B2 hosts running UUCP.  One has a printer attached,
{T} and we wish to allow the other host to send print jobs remotely via UUCP.
{T} How is this best achieved?

In response rad@genco.bungi.com (Bob Daniel) writes:
{B} The concept is simple.  Just make an interface that redirects
{B} the output to a file and then uucp the file to the destination.  Then,
{B} do a uux on the remote machine.

{T} Any comments, or, better yet, experiences
{T} with accomplishing the above feat would be highly appreciated.

No sweat.

As Bob pointed out it really is simple to do.  We implemented the same thing
here on our Chrysler 3B2s.  Of course, there is a lot of fluff that you can
add to make things work "better" but the concept was:
	just copy the file that the user wants to print, and then
	do a remote uux of the command lp, then remove the copy.
The heart and soul of our script to do this looks like this:
	#
	# Print the file on remote computer
	#
	${CAT} ${SPOOLNAME} | \
	${UUX} - ${MACHINE}!"${LPCMD} ${REMOTEP} ${OPTIONS}" &

Of course our script fills in all of the variable names as needed.  Like

Also note that the "-" as the second parm of uux is real important.

One of the biggest troubles that we had doing this was realizing that the
options that are set *really need* to be passed in the uux.  Hence laser
jets will not function properly if you do not `lp -d <printer> -o"stty=-opost"`
and if you do not pass that -opost you're in trouble.

Good luck.

						- Norm.
-- 
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Norman J. Meluch ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
| Mail: norm@cfctech.cfc.com           Fax:(313)948-4975  Voice:(313)948-4809 |
| Note: The opinions expressed here are in no way to be confused with valid   |
|_______ideas or corporate policy.____________________________________________|

jon@jonlab.UUCP (Jon H. LaBadie) (12/19/90)

In article <1868@fallst.UUCP>, tkevans@fallst.UUCP (Tim Evans) writes:
> In <18809@netcom.UUCP> cmilono@netcom.UUCP (Carlo Milono) writes:
> 
> >I have implemented this using UUX commands; below is a sample command
> >which can be included in a standard lp/interfaces script, as appropriate.
> 
> >uux "remote!lp !myfile1"  [this would print myfile on a printer on remote]
> 
> You must also "authorize" the 'lp' command to be executed via uux.

On some versions of UNIX in which I have done this, the data files were
removed as soon as the remote lp command was executed.  However, the
printing via lpsched occurred at some later time and had no data files
to print.

Thus, it was necessary to either write a customized shell script to
copy the data files to a safe location (then administrative cleanup
was required), pass the files to lp via standard in ("lp < data"),
or use the copy option ("-c") of lp to force it to make private
copies of the data that it automatically deletes upon printing.

Jon

-- 
Jon LaBadie
{att, princeton, bcr, attmail!auxnj}!jonlab!jon