[aklug] Re: linux bash backgrounding and I/O redirection

From: Jeremy Austin <jhaustin@gmail.com>
Date: Mon Jul 23 2012 - 16:01:41 AKDT

On Mon, Jul 23, 2012 at 3:48 PM, techno curmudgeon
<technocurmudgeon@gmail.com> wrote:
> Hey folks,
>
> It's been a while since I've done much scripting, and my bash-fu is
> embarrassingly lacking now. Anyway, if someone can give me a pointer
> I'd appreciate it.
>
> I'm having bash backgrounding and file redirection issues. I expect
> it's something simple and obvious, and I'm ok with that 8).
>
> OVERVIEW:
>
> I need to attach to a remote sensor box and record the ascii
> datastream from that box onto disk files. I'd like to break
> that datastream into segments of about 10 minutes each with a datetime
> stamp suffixed onto the filename.
>
> To that end, I've got a bash script generates a filename, connects to
> the remote box using nc, and > to the filename. (note that I've
> set the timing in the attached code to 1 minute, rather than 10 minutes).
>

I wonder if this is any help?

http://stackoverflow.com/questions/526782/how-do-i-limit-the-running-time-of-a-bash-script

http://www.pixelbeat.org/scripts/timeout

http://redflo.de/tiki-index.php?page=Bash+script+with+timeout+function

I myself do something similar to using nc, although in my case I am
logging MP3 data, and using socat, which has a -T timeout option; in
my case however, I am rolling over to a new timestamp whenever no data
has been received > $TIMEOUT seconds. I don't think this will help
you, so I won't post my script here.

I think the above examples, with launching a subshell and then killing
it after sleep n, might be what you want.

jermudgeon
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Mon Jul 23 16:02:09 2012

This archive was generated by hypermail 2.1.8 : Mon Jul 23 2012 - 16:02:09 AKDT