summaryrefslogtreecommitdiff
path: root/home
diff options
context:
space:
mode:
authorXiao Pan <gky44px1999@gmail.com>2023-03-01 17:52:53 -0800
committerXiao Pan <gky44px1999@gmail.com>2023-03-01 17:52:53 -0800
commit102da94f7ef6d7b476dbfd5ac84cf03dcf132cb4 (patch)
tree832b6f66c86f62a3b552ca5a8add16d669790fe2 /home
parent95cf1b57b3c8eeb3362eb5dc110f833137f767d9 (diff)
update
Diffstat (limited to 'home')
-rwxr-xr-xhome/xyz/.local/bin/mrt15
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"