[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Redirect printer output to email?



On Mon, Sep 28, 1998 at 06:33:55PM +0000, Kent West wrote:

> This sounds like a method I'd like to try, but I'm too new at Linux/Unix
> to have much of a clue. Could you possibly give me a snippet of example of
> what my /etc/printcap should look like for this, as well as a general idea
> of what the email filter would look like, and how to daisychain them
> together? Thanks.

Ok. First install lprng. The default configuration allows for bounce queues,
so you should have that. I think you want something like this:

pager:\
        :if=/usr/local/sbin/pager-filter:\
	:bq=printer:\
	:[some other options]:

printer:\
        :lp=/dev/lp0:\
	:if=/etc/magicfilter/somefilter:\
        :sd=/var/spool/lpd/printer:

/usr/local/sbin/pager-filter could be something like this:

#!/usr/bin/perl

my $MAIL;

open MAIL, '|mail -s "Some subject" some@address';

while (<>) {
        print MAIL;
        print;
}

close MAIL;

Of course, you might need something more fancy to accomodate your pager's
needs. Also, the second filter could bounce to something else, ie, it could
just filter stuff and pass it to another "printer" (which is what I do
locally to do proper filtering before sending the jobs to a Windows NT
machine)

HTH,

					Marcelo


Reply to: