krebs.backup fping: select fastest by elapsed time

This commit is contained in:
tv 2021-01-21 17:29:01 +01:00
parent e2ed72a780
commit 1cd73df0c8

View File

@ -226,10 +226,14 @@ let
# XXX Is one ping enough to determine fastest address?
fastest-address = host: ''
{ ${pkgs.fping}/bin/fping </dev/null -a \
{ ${pkgs.fping}/bin/fping </dev/null -a -e \
${concatMapStringsSep " " shell.escape
(mapAttrsToList (_: net: head net.aliases) host.nets)} \
| ${pkgs.coreutils}/bin/head -1; }
| ${pkgs.gnused}/bin/sed -r 's/^(\S+) \(([0-9.]+) ms\)$/\2\t\1/' \
| ${pkgs.coreutils}/bin/sort -n \
| ${pkgs.coreutils}/bin/cut -f2 \
| ${pkgs.coreutils}/bin/head -n 1
}
'';
in out