-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
dep via tde-users <users(a)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
-----BEGIN PGP SIGNATURE-----
iQJRBAEBCgA7FiEELSc/6QwVBIYugJDbNoGAGQr4g1sFAmbxWKwdHGJvdWRpY2Nh
c0Bza2ltYmxlMDkucGx1cy5jb20ACgkQNoGAGQr4g1skdBAAgOCp322GrFIvPehg
ApcTiGoCFJYAdgWUFb6BMF0pra9Jiq2FaTMVS0C0vIONWiRh1AtihOWHmeaaMT5n
uHGivYL22Y8EoCIbJIu5pZitXFyEDfXZk62s9431VaMNphRd6ScGUEANbCsNQnSo
yfgJqDSUg9p2fnLPxCf3e5VWFRKzcEGlPkv8w/xODOZTxAs8FQAZ8O7lt5CmZwHc
KtthWr//NBrDn3leNYZg3dIM3CG7RdqjOpkjnsBRyxMyTN+9H/Tg7xC3CkPNzmvS
YcJcFOG+43hz1GScaI1Okf4frhvCLiNu4miiwoDQW0N5sgHrNPJ2u6XdkF2Eu61/
3aI7e0/+2EnfdbqA/JAy1pFVcOkr917n8mWqtGEn21VM+9WxUcvgHVdEPRVCzmik
tG8tE0Aff8NML1LkcT3EfPyzaI8hHcOZvj3+Bdx4hsIvTJAzgMlM4hA3BtG7WcxX
Md67yRUdb6ianEb80iFIF535ns7DohvVQChlycoeDwXr63N+dmXfru1m602AVRv9
Rh+I9JGiKlaFlPnfW5zXbUCPxJkIfmY6ul+xrAk+E3WFEphAAY/fl/B/W6k2BEYH
vtSSAtxc9hR0pcAnQVvZb8YHe3j9nH3du32vIiKH618qu6RWDnVso0U2FmjzwuAI
7OPtjp+Fg3w/UWgaKjcF1iqA4Y0=
=bhCI
-----END PGP SIGNATURE-----