-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
dep via tde-users users@trinitydesktop.org writes:
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.
Why use a script, does your linux setup have a program called 'uptimes' (in Debian) which uses the command `uprecords` which gives your longest uptimes and your cumulative uptimes and your cumulative downtimes.
Does this help?
Thanks Sharon. - -- A taste of linux = http://www.sharons.org.uk TGmeds = http://www.tgmeds.org.uk DrugFacts = https://www.drugfacts.org.uk Debian 12.7, Fluxbox 1.3.7, emacs 31.0.50, org 9.7.11