add connection test recipe
This commit is contained in:
parent
0364e0e9e1
commit
8fd7ece12c
1 changed files with 49 additions and 0 deletions
49
Justfile
49
Justfile
|
@ -332,3 +332,52 @@ uuid-to-device-name remote:
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e -o pipefail
|
set -e -o pipefail
|
||||||
ssh {{remote}} 'nix run nixpkgs.dmidecode -c dmidecode -s system-uuid' | xxhsum --quiet -H1 | awk '{print $1}'
|
ssh {{remote}} 'nix run nixpkgs.dmidecode -c dmidecode -s system-uuid' | xxhsum --quiet -H1 | awk '{print $1}'
|
||||||
|
|
||||||
|
test-connection:
|
||||||
|
#! /usr/bin/env nix-shell
|
||||||
|
#! nix-shell -p curl zsh
|
||||||
|
#! nix-shell -i zsh
|
||||||
|
#! nix-shell --pure
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
FAILURE="false"
|
||||||
|
output=$(
|
||||||
|
echo "$(date)\n---"
|
||||||
|
for url in \
|
||||||
|
"https://172.16.0.1:65443/0.7/gui/#/login/" \
|
||||||
|
"https://192.168.0.1" \
|
||||||
|
"http://172.172.171.9" \
|
||||||
|
"https://172.172.171.10:65443" \
|
||||||
|
"https://172.172.171.11:65443" \
|
||||||
|
"https://172.172.171.13:443" \
|
||||||
|
"https://172.172.171.14:443" \
|
||||||
|
"http://172.172.171.15:22" \
|
||||||
|
"http://172.172.171.16:22" \
|
||||||
|
"https://crates.io" \
|
||||||
|
"https://holo.host" \
|
||||||
|
; \
|
||||||
|
do
|
||||||
|
print "trying ${url}": $(
|
||||||
|
curl_output=$(curl --http0.9 -k --head --connect-timeout 0.5 ${url} 2>&1)
|
||||||
|
# if [ $? -ne 0 ]; then
|
||||||
|
if [[ "$curl_output" == *timeout* ]]; then
|
||||||
|
echo failure: $(echo ${curl_output} | tail -n1)
|
||||||
|
# BUG: outer FAILURE is not set by this
|
||||||
|
FAILURE="true"
|
||||||
|
else
|
||||||
|
echo success
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
done
|
||||||
|
)
|
||||||
|
clear
|
||||||
|
echo ${output}
|
||||||
|
|
||||||
|
if [[ ${FAILURE} == "true" ]]; then
|
||||||
|
echo something failed
|
||||||
|
tracepath -m5 -n1 172.16.0.1
|
||||||
|
tracepath -m5 -n1 192.168.0.1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue