mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-11-23 21:02:09 +00:00
23 lines
623 B
Bash
23 lines
623 B
Bash
#!/bin/sh
|
|
# Ensure that we can connect to seirdy.one, and print the ipv4/ipv6 addresses used. The latter makes searching through my server logs easier.
|
|
# Return a bad exit code if we can't connect over either ipv4 or ipv6.
|
|
|
|
# no pipefail here since there are no pipes.
|
|
set -e -u
|
|
|
|
echo "running connecivity check"
|
|
|
|
ipv6_success=1
|
|
ipv4_success=1
|
|
|
|
curl_wrapper="$(dirname "$0")/curl-wrapper.sh"
|
|
|
|
"$curl_wrapper" -6 'https://seirdy.one/ip' || ipv6_success=0
|
|
echo
|
|
"$curl_wrapper" -4 'https://seirdy.one/ip' || ipv4_success=0
|
|
echo
|
|
|
|
if [ "$ipv6_success" = 0 ] && [ "$ipv4_success" = 0 ]; then
|
|
echo "Failed to connect"
|
|
exit 1
|
|
fi
|