[Sunhelp] How to print to a LPR

Andrew Wallace andreww at pcs.co.uk
Wed Sep 27 04:09:27 CDT 2000


Hi Jonathon,

It looks as if you have most of the information already.

I've done something like this to hijack the print process.

As I remember, the first thing is to write your script that does what
you like with the print spool. In your case, send it to the IP address.

Once you've written this script, make a copy and then put a copy in the
/etc/lp/interfaces directory and call it what you want, mostly people
call it the same name as they're going to give to the printer.

Then you run the lpadmin command as root. Since you want the spooled
file to be postscript, in your case this would be:
# lpadmin -p <printer name>  -I postscript -T PS -i
/etc/lp/interfaces/<scriptname> -v /dev/null

Then run 
# enable <printer name>
and 
# accept <printer name>

Note, that if you later disable the printer, then the script you place
in the /etc/lp/interfaces file will be deleted, so it is important to
keep a copy of this script elsewhere.

Here is a small example script that will make a copy of the spooled
document in /tmp for you:

#!/bin/sh
tempFile=/tmp/spooled.$$
/bin/cat $6 > tempFile

exit 0
#end

Hope this helps,

Andy Wallace





More information about the SunHELP mailing list