Some months ago I asked here if there were a way to log my ISP's downtime,
and got a useful answer. Today I've been attempting to refine it a bit,
and there is some progress, but not success.
Here's what I have:
[code]
#!/bin/bash
#monitor frontier communications downtime
ping -i 3 -O -D 1.1.1.1 | while read row
do
awk '{ sub(/[0-9]{10}/, strftime("%Y-%m-%d %H:%M:%S", substr($0,2,10))) }
1' <<< "$row"| tee ~/frontier_downtime.log
done
[/code]
Most of it is simply converting internet time to human time, because I
might have to use it to support a complaint. It runs fine in a terminal, a
nice ping and result every three seconds, but only writes the first line,
the first ping result, to the logfile. (And yes, ir's probably sloppy.)
What do I have wrong?
Bonus question: any way to keep it running with the terminal closed? I
can't even use & to free the terminal; I'd like to start the thing and
have it cook merrrily away without a terminal open or even minimized, and
use top or killall to dispose of it if that becomes necessary.
I'm pretty sure I'm missing something obvious.
--
dep
Pictures:
http://www.ipernity.com/doc/depscribe/album
Column:
https://ofb.biz/author/dep/