1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-10 08:12:11 +00:00
seirdy.one/scripts/connectivity-check.sh

24 lines
623 B
Bash
Raw Normal View History

#!/bin/sh
2023-11-25 21:40:52 +00:00
# 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
2024-04-05 21:03:13 +00:00
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