remote printing through lp

Greg A. Woods woods at robohack.UUCP
Wed Feb 28 15:55:37 AEST 1990


I use the following script, along with 'COMMANDS=rmail:lp' (or
something close) in the destination machine's Permissions file.

Be sure to read the comments, they point out a few caveates and
configuration options.

-------------- cut here --------------
#
# lp interface for a remote printer
#
#
PATH=/bin:/usr/bin:/usr/lbin:/usr/local/bin ; export PATH

PRINTER=`basename $0`
TITLE=$3
COPIES=$4
OPTIONS=$5
#
# NOTE, some lp's (notably the one on 3B1's) have 6 options
#
shift; shift; shift; shift; shift
files="$*"

# mktable is in /usr/lbin on most SysV's
#
# /usr/spool/lp/remote_mach is a list of printers and sites, separated
# by tabs:
#
#AppleLaser	gate
#
#
MACHINE=`mktable /usr/spool/lp/remote_mach | grep $PRINTER | cut -f2-`

# keep a log of remote print jobs
#
echo "`date +%D-%T`:$PRINTER:$MACHINE:$RAW:-t$TITLE:-o$OPTIONS:-n$COPIES:$files" >> /usr/spool/lp/remlog

for F in $files
do
	FILES="$FILES !$F"
done

# NOTE: uux "sees" single quotes.  You must not put them anywhere where
# white space is not allowed (i.e. -t'$TITLE'), as uux will introduce
# a space before the first single quote, and similarly for ending single
# quotes if there is not already whitespace.

uux -n -C "$MACHINE!lp -c -d$PRINTER '-t$TITLE' '-o$OPTIONS' -n$COPIES $FILES" >> /usr/spool/lp/remlog 2>&1

# don't confuse lpsched!
exit 0
-- 
						Greg A. Woods

woods@{robohack,gate,eci386,tmsoft,ontmoh}.UUCP
+1 416 443-1734 [h]   +1 416 595-5425 [w]   VE3-TCP   Toronto, Ontario; CANADA



More information about the Comp.unix.questions mailing list