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

Re: Redirect printer output to email?



Marcelo E. Magallon wrote:
> 
> On Wed, Sep 23, 1998 at 09:58:35AM -0500, Kent West wrote:
> > This isn't specifically Debian-related, but if I can get this done it'll be
> > a major score on campus for Linux in general and Debian specifically.
> >
> > Can I print from a Win95 box to a Debian queue and route that output to an
> > email message as well as to a printer?
> 
> Easy. Use lprng. It can daisychain filters. Read stdin, pass the data to
> stdout and at the same time pass the relevant data to a pine to mail. Use
> the second filter to talk to samba to get the file printed.
> 
> BTW, sounds really interesting.
> 
>                                         Marcelo

Kent writes:
I'm not yet anywhere near Linux-literate: Brian sent me the following
snip of example. 

> Something like the following, don't take my word on it. I am not a
> great shell programmer.
> 
> #!/bin/sh
> # the script called by 'if' in the printcap for the samba printer
> # 
> # assume input to filter is plain text
> 
> # copy stdin to tmp file
> cat - > /tmp/pager.$$
> 
> # feed to pager email
> mailx -s "Page Message" pageraddress@pagercompany < /tmp/pager.$$
> 
> # pass stdin through ascii to ps converter and then 
> # let ghostscript create a printer file to pass on to the 
> # printer.
> a2ps [options] /tmp/pager.$$ | ghostscript -s -sDEVICE=printername ....\
> -sOUTPUTFILE=- -
> 
> rm /tmp/pager.$$
> # end

I tried putting this in my magic filter and then tried a test print (ls
-l | lpr -Pbeeper) and the printout showed up on the printer, but no
mail appeared and no /tmp/pager file appeared. 

The idea of daisychaining two filters as suggested by Marcelo sounds
intriguing (and cleaner). I'd go with whichever method can be made to
work. Any clues?

Thanks.


Reply to: