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

Re: Print & Email the same document



kmself@ix.netcom.com wrote:

> 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
>

The purpose of the app is to notify on-campus personnel whenever a call is placed
from on-campus to the city's 911 service.

It's a proprietary Win95-based app running on NT4.0. Whenever someone on campus
calls 911 our telephone switch routes the call to the city's 911 call center and
sends via hard-wire a notification to the NT box running the app. The app then adds
a line to the on-screen window showing that a 911 call was placed at such-n-such
time from such-n-such extension. The app also brings up a big red flashing box on
the screen for a few seconds to let the operator know that a 911 call has just been
made. In addition to the "log" list and the big red flashing box, it can
automatically generate a printout OR an email message, but not both. The "print or
email" option is a button-click-controlled setting within the app itself, and it
prints to a standard Windows printer or emails to an address setting that's defined
within the app itself. The message sent to the printer/email is not configurable,
but is basically the same info that goes into the on-screen log window. Currently
the 911 notification server computer is sitting in the office of one of our
emergency coordinators, and the printout is sent to a printer across campus sitting
in the Campus Police station.

I figured that by sending the printout to a Linux print queue, there must be some
way to generate both a printout and an email message from that. This way we could
notify the campus police station, the campus cops roaming the campus via
email-to-pager, and other interested parties via email. This would also serve to get
a Linux box in our server room, where over the past few years we've migrated to an
NT shop, but there's been enough disaffection with Windows that as soon as the
decision makers can see real reasons to have a Linux box some changes might be
forthcoming. However, as mentioned, I've not had any success with this project. And
it seemed so simple in the beginning....

One other detail: in testing I'm trying to print to my local printer attached to my
local Debian box. Once in production, we'd probably put a Linux box in the server
room and then have to print to a remote JetDirect box attached to a dot matrix
printer (so that the clatter would make the CopShop personnel hear and take notice,
as opposed to the relatively quiet LaserJet), and I understand that print filters
are not run for remote printers, so that might be another wrinkle.





Reply to: