diff options
author | Xiao Pan <gky44px1999@gmail.com> | 2023-03-01 17:52:53 -0800 |
---|---|---|
committer | Xiao Pan <gky44px1999@gmail.com> | 2023-03-03 14:24:48 -0800 |
commit | 02513aaa294a8a6aacb9565f1c9d3e206f5fa84e (patch) | |
tree | 32c47fccf6800d96f19e9b995c5be84ed58d8a0a /home/xyz/.local | |
parent | 36dc27b22821cc60bafb106487574c37091b7bb9 (diff) |
update
Diffstat (limited to 'home/xyz/.local')
-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" |