[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Sheflug] fax script wizardry
Hi All,
I'm trying to find, write or rip off and modify a small shell script
that's called by inittab that will convert incoming faxes into jpegs.
I can do the conversion no problem (ImageMagick rocks!) but I'm
having trouble with the logic. This script's going to hang around in
the background until a fax appears in /var/spool/fax/incoming/. Then,
once the fax has arrived it's going to do the conversion and move it
somewhere else. Then it'll exit and respawn ready for the next fax (I
hope).
The trouble I'm having is with the test condition.
I can test for the existence of a file, but that's not enough: in the
first moments that a fax arrives it's incomplete (just the first few
bytes of the file) and then it grows bigger until it's fully there.
And it isn't possible to predict how long it'll take to arrive,
either. Only after its size stabilises should the script start to do
its evil work.
(I could put in a really long delay as a kludge to make sure the
whole fax has arrived, but I'd like the script to respond as fast as
possible so that there isn't a massive build-up of unprocessed faxes
if incoming traffic is heavy. If that happens then the script will be
waiting each time it detects a new file, and if there's a backlog
it'll just get worse and worse!)
Any suggestions how to do this? I understand that Hylafax has the
option to call a script after a fax arrives, but I'm using rungetty -
which doesn't seem to have this option.
If you've made a script to do this sort of "wait until" function can you help?
Cheers,
James
=====
--
who: James Wallbank
org: Redundant Technology Initiative
tel: +44 114 2495522
fax: +44 114 2495533
eml: rti [at] lowtech.org
web: www.lowtech.org
loc: Access Space
1 Sidney Street
Sheffield
S1 4RG
UK
___________________________________________________________________
Sheffield Linux User's Group - http://www.sheflug.co.uk .
To unsubscribe from this list send mail to
shef-lug-request@list.sheflug.org.uk with the word
"unsubscribe" in the body of the message.
GNU the choice of a complete generation.