diff options
author | Xiao Pan <gky44px1999@gmail.com> | 2023-03-01 17:52:53 -0800 |
---|---|---|
committer | Xiao Pan <gky44px1999@gmail.com> | 2023-03-01 17:52:53 -0800 |
commit | 102da94f7ef6d7b476dbfd5ac84cf03dcf132cb4 (patch) | |
tree | 832b6f66c86f62a3b552ca5a8add16d669790fe2 /home | |
parent | 95cf1b57b3c8eeb3362eb5dc110f833137f767d9 (diff) |
update
Diffstat (limited to 'home')
-rwxr-xr-x | home/xyz/.local/bin/mrt | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/home/xyz/.local/bin/mrt b/home/xyz/.local/bin/mrt index 050d5513..8cd136fb 100755 --- a/home/xyz/.local/bin/mrt +++ b/home/xyz/.local/bin/mrt @@ -29,10 +29,17 @@ $0 ~ location {f=1;next} print $1 }'); do mullvad relay set hostname "$relay" - while ! mullvad status | grep -q "Connected to $relay"; do - sleep 0.1; + t=0 + while [ $t -lt 20 ]; do + if mullvad status | grep -q "Connected to $relay"; then + if curl -Ism"$curl_maxtime" "$website"; then + good_relays="$(printf '%s\n' "$good_relays" "$relay")" + fi + break + fi + sleep 0.1 + t=$((t+1)) done - curl -Ism"$curl_maxtime" "$website" && good_relays="$good_relays $relay" done -echo "$good_relays" | tee "$XDG_DOCUMENTS_DIR/logs/mrt_$(printf "$location" | tr '[:upper:] ' '[:lower:]_')_$website.log" +echo "$good_relays" | tee "$XDG_DOCUMENTS_DIR/logs/mrt_$(printf '%s' "$location" | tr '[:upper:] ' '[:lower:]_')_$website.log" |