
	Remote_host Print via FTP.


	1.	FTP this file to the unix system

	2.	create usrspoollpctos directory

		mkdir usrspoollpctos

	3.	set permissions and ownership for ctos directory

		chmod +wr usrspoollpctos
		chown lp usrspoollpctos
		chgrp bin usrspoollpctos

	4.	shut down the lp scheduler

		usrliblpshut

	5.	add the new printer

		usrliblpadmin premotegps l vdevnull iremotegps.sh

	6.	start up the lp scheduler

		usrliblpsched

	7.	tell the lp scheduler to accept things for remotegps

		usrlibaccept remotegps

	8.	enable remotegps

		usrbinenable remotegps

	9.	check out the lp system status

		usrbinlpstat t

	10.	modify the remote_??? variables below describing the CTOSBTOS system

	host		= hostname						 required
	type		= ftp transfer type				 required

	login		= ftp username
	password	= ftp password

remote_host=show
remote_type=image

remote_login=remotegps
remote_password=remotegps

	NOTE: there are 2 ways to login to ftp

	1.	use remote_variables if they are not zero length
	2.	.netrc file in  directory with following entries:

		machine remote_host
		login remote_login
		password remote_password

		where the remote_?? things are replaced with the real entries
		the remote_host variable in this script must still be specified

	standard unix lp command output

	lp dremotegps n2 o'2 hplaser' t'This is the title' file1 file2

	interface	= interfaceremotegps (interfaceprintername)
	job			= remotegpsxxxx (where xxxx is a unique number for remotegps)
	owner		= (signon user name for person using lp command)
	title		= This is the title (t option)
	copies		= 2 (n option)
	options		= 2 hplaser (o option (must be 0, 1 or 2 andor gps device))
	files		= file1 file2 (files to be printed)

interface=$0
job=$1
owner=$2
title=$3
copies=$4
options=$5
shift; shift; shift; shift; shift
files=$*

	printer		= remotegps

printer=basename $interface

	host		= (output of hostname command)

host=hostname

	job			= xxxx (strip remotegps from job)

job=echo $job | sed s$printerg

	cleanup directory
pwd > usrspoollpadminslpinterfaceslala
rm f usrspoollpctos*

	now create script and execute ftp once for each file

for file in $files
do

	base	= file name without directory

	base=basename $file

	base	= remove the xxxx from base

	base=echo $base | sed s$jobg

	copy the file to the ctos directory

	cp $file usrspoollpctos$base

	copy the file to the ctos directory

	create ftp script file (see above notice about ftp login)

	echo open $remote_host >> usrspoollpctosftp
	if [ n $remote_login ]
	then
		echo $remote_login >> usrspoollpctosftp
	fi
	if [ n $remote_password ]
	then
		echo $remote_password >> usrspoollpctosftp
	fi
	echo type $remote_type >> usrspoollpctosftp

	name the file remotegps_xxxx_$base on the CTOSBTOS system

	echo put usrspoollpctos$base $printer\_$job\_$base >> usrspoollpctosftp
	echo bye >> usrspoollpctosftp

	usrbinftp i < usrspoollpctosftp > devnull 2> devnull

	rm f usrspoollpctos*

done

	write out params file

echo :Host:$host >> usrspoollpctosparams
echo :Printer:$printer >> usrspoollpctosparams
echo :Job:$job >> usrspoollpctosparams
echo :Owner:$owner >> usrspoollpctosparams
echo :Title:$title >> usrspoollpctosparams
echo :Copies:$copies >> usrspoollpctosparams

	checkout options 0,1,2 mode, otherwise gps device name

for opt in $options
do
	case $opt in
		0) echo :Mode:0 >> usrspoollpctosparams ;;
		1) echo :Mode:1 >> usrspoollpctosparams ;;
		2) echo :Mode:2 >> usrspoollpctosparams ;;
		*) echo :Device:$opt >> usrspoollpctosparams ;;
	esac
done

	1 line for each file

for file in $files
do
	base=basename $file
	base=echo $base | sed s$jobg
	echo :File:$base >> usrspoollpctosparams
done

	done with params file output

	now create ftp script file


echo open $remote_host >> usrspoollpctosftp
if [ n $remote_login ]
then
	echo $remote_login >> usrspoollpctosftp
fi
if [ n $remote_password ]
then
	echo $remote_password >> usrspoollpctosftp
fi
echo type $remote_type >> usrspoollpctosftp

	name the params file remotegps_xxxx_params on the CTOSBTOS system

echo put usrspoollpctosparams $printer\_$job\_params >> usrspoollpctosftp
echo bye >> usrspoollpctosftp

	execute the ftp client with input from script and output tossed

usrbinftp i < usrspoollpctosftp > devnull 2> devnull

	cleanup directory

rm f usrspoollpctos*

exit 0
