The solution to my particular programming problem is to use 'timeout'
instead of the 'background/sleep/kill' loop I was using. Thanks to
Jeremy Austin.
More fundamentally, as near as I can tell from google and man and
superuser and such, the stdio system only flushes on exit from the
calling shell, instead of every x seconds. This is a 'feature'. So
when the backgrounded process was killed, no data got flushed to disk.
(as an aside, this actually doesn't seem right to me, so either I'm
not understanding what I'm reading, or my instincts for what's 'right'
is wrong. There is precedent for both 8) )
Regarding inserting into a database, I like that. In fact, chances
are I'm going to have to do something similar to this exercise for
some different sensors sometime later this year. I'll probably take
the database approach for that.
Thanks to all.
Here's the current, working bash script:
------------------------------
#!/bin/bash
DEST=/home/sensors/gps1
[[ -d $DEST ]] || mkdir -p $DEST
while true
do
DESTFILE=$DEST/"gps1-freq-ref-capture-"`date +"%Y-%m-%d-%H%M"`
timeout 600 nc fepts03 20014 > $DESTFILE
done
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Wed Jul 25 14:46:53 2012
This archive was generated by hypermail 2.1.8 : Wed Jul 25 2012 - 14:46:53 AKDT