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

Re: Print & Email the same document



On Mon, Apr 24, 2000 at 02:40:42PM -0500, Kent West wrote:
> kmself@ix.netcom.com wrote:
> 
> > On Fri, Apr 21, 2000 at 11:16:59AM -0500, Kent West wrote:
> > > I've been trying to do this off-and-on for two years, and although
> > > I've had lots of help, nothing has ever worked. Can I assume that
> > > it's impossible to print and email a document from one command?
> >
> > You've outline of a rather complicated method.  How about:
> >
> > cat <<EOF > /usr/local/bin/print-n-mail
> > #!/bin/bash
> > lpr \$@
> > mail -s \"\$@\" \$USER < \$@
> > EOF
> >
> > chmod +x /usr/local/bin/print-n-mail
> >
> > ...or how doesn't this fit the bill?
> >
> > I would in general avoid munging an existing utility which does one
> > thing to make it do two.  Rather I'd write a new utility to combine the
> > two existing ones.
> >
> > --
> > Karsten M. Self <kmself@ix.netcom.com>           http:/www.netcom.com/~kmself
> 
> I might have left out detail that might prove to be important. This
> printer queue will be shared over the network so that a 911 call
> notification server can print to it, generating both the printout and an
> email and a beeper message (via email). The 911 call notification server
> is running on a WindowsNT (gag, aack) box. Currently, the 911 software
> can't print and email, so I wanted to bring Linux into the picture to
> demonstrate to the big-whigs that Linux solves problems. Only thing is,
> I've been trying for two years off-and-on to solve this problem with
> no results.
> 
> The method you use seems to work for local command-line printing, but
> I'm having trouble seeing how I can use it to allow a Windows box to
> print to it via the network. But then, I'm a relative newbie to Linux,
> so I may be missing the obvious.

The printer queue method may be the way to go then.  What I'd suggest,
though, is that you set up what's essentially a pseudo queue, if
possible, and using something like the filter above to take the input
and send it to both email and another (real) printer queue.  Though this
still sounds like a hack.  I'm not familiar with print filters, and
suspect you'd have to munge/redirect output as you'd otherwise print
to some spool or another, which you actually don't want to do.  The
default Debian print filters are shell scripts, you might do well to
look at them.

This isn't the sort of thing I spend a lot of time working on. 

You might also consider several other "small details" you haven't told
me <g>, such as what kind of application is generating the print job in
the first place, how much control you have over that, whether or not
this is a web-based application (drop in a CGI to print & mail), etc.

The other general direction I might head would be to create some sort of
custom listening daemon which would, again, take its input and split it
into two outputs

Good luck.

-- 
Karsten M. Self <kmself@ix.netcom.com>           http:/www.netcom.com/~kmself
    What part of "Gestalt" don't you understand?
    http://gestalt-system.sourceforge.net/
GPG fingerprint: F932 8B25 5FDD 2528 D595  DC61 3847 889F 55F2 B9B0

Attachment: pgpOCRonnbQNR.pgp
Description: PGP signature


Reply to: