Faceless CGI challenge/print incoming text-email files

Sadhunathan Nadesan sadhu at castandcrew.com
Mon Dec 9 10:49:00 EST 2002


| Message: 5
| Date: Sat, 7 Dec 2002 15:33:46 -1000
| Subject: Faceless CGI challenge/print incoming text-email files
| Cc: metacard at lists.runrev.com
| To: use-revolution at lists.runrev.com
| From: Sannyasin Sivakatirswami <katir at hindu.org>
| Reply-To: metacard at lists.runrev.com
| 
| OK, well maybe it's not a challenge maybe it asking if someone has done 
| this already:
| 
| Goal: have a faceless metacard/revolution process running on a OSX 
| server that will  check a directory for files (deposited there by an 
| email server), on a timed interval,  if files are found, format these 
| to letter size in a particular font and print to a specific networked 
| printer  in another office on the LAN.
| 
| I think i could set this up with an open stack in the GUI, but don't 
| know how to script to choose a specific printer without having 
| previously selected that printer as the default printer for the whole 
| server. Use of a "page set up" request... returns a system dialog 
| box... but this has to run without human interaction  i.e. need to be 
| able to poke, by script, the values that are usually entered from the 
| system print set up dialog box.
| 
| Can do?
......


Hi Swami

Can do?  No sweat.  This is the kind of thing we do ALL the time
on Unix systems.  I would tend to write it in Bourne shell script,
happy to do it for you if you like.  I know you like writing everything
in MC, once you saw how easy it is you could convert it.

You could set it up to run from cron on a timed interval (ie, put
it in your cron table), or you could start it up as a deamon (good
idea to put it in your .rc files, so it would start up at reboot)
and then put a sleep command in it.

in psuedo code, it would be something like this

#!/bin/sh
cd right-directory
while (true)
  if [ email-file exists ]; then
    cat email-file | fmt | pr | lpr
    rm -f email-file
  endif
  sleep 300
end while


Of course with specifics for your system, maybe strip out mail headers
or other refinements, handle mutliple files, remove them, use the
correct printer name and arguments, assuming you do have printer filters
somewhere, some error checking, etc.  Then again, I'm not sure how much
Apple has messed up your BSD Unix?  What I have heard is that Jaguar is
just a wrapper and it's true BSD underneath.

Aum Aum
Sadhu

ps:  "There's an easier way to do that, grin!"




More information about the metacard mailing list