From: Johannes Truschnigg Date: Sun, 20 Mar 2022 15:05:50 +0000 (+0100) Subject: Write suggested config values to timestamped config file X-Git-Url: https://johannes.truschnigg.info/gitweb/?a=commitdiff_plain;h=fa3e1e6ac0c956178855b1f7aca4ccfc0b0079df;p=sqm_lagthrottle Write suggested config values to timestamped config file --- diff --git a/sqm_lagthrottle_suggest_config.sh b/sqm_lagthrottle_suggest_config.sh index 51ab8c6..c55d58b 100755 --- a/sqm_lagthrottle_suggest_config.sh +++ b/sqm_lagthrottle_suggest_config.sh @@ -15,13 +15,18 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -for p in sort sleep cat awk tee fping +TZ=UTC +LC_ALL=C +export TZ LC_ALL + +for p in sort sleep cat awk tee date fping do type "${p}" >/dev/null || { printf 'FATAL: Required program "%s" not installed.\n' "${p}" >&2; exit 1; } done fpo="/tmp/fping_${$}.out" sto="${fpo}.stats" +cfgo="./sqm_lagthrottle.conf.$(date +%s)" POTENTIAL_PING_PEERS='1.1.1.1 8.8.8.8 a.root-servers.net b.root-servers.net c.root-servers.net d.root-servers.net e.root-servers.net f.root-servers.net g.root-servers.net h.root-servers.net i.root-servers.net j.root-servers.net k.root-servers.net l.root-servers.net m.root-servers.net fastly.com fast.com gstatic.com' set -u @@ -29,6 +34,8 @@ set -u echo "This script will ping potential peers for two minutes," >&2 echo "record stats, and recommend configuration values for sqm_lagthrottle.sh" >&2 echo "" >&2 +printf 'Suggested values will also be written to "%s"\n' "${cfgo}" >&2 +echo "" >&2 echo "Please keep your Internet-directed traffic at a minimum while pinging." >&2 echo "" >&2 echo "Hit the [ENTER] key when ready, or [CTRL]+[C] to abort..." >&2 @@ -93,7 +100,7 @@ END { { #print p " " peers_pinglist[p] } -}' "${fpo}" +}' "${fpo}" | tee -a "${cfgo}" awk ' { @@ -112,7 +119,7 @@ END { } } printf "\"\n" -}' "${sto}" +}' "${sto}" | tee -a "${cfgo}" echo "" >&2 echo "" >&2