Skip to content

Instantly share code, notes, and snippets.

@digitalbricklayer
Last active November 23, 2020 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digitalbricklayer/719fe73f554208b648dd6129364fc84c to your computer and use it in GitHub Desktop.
Save digitalbricklayer/719fe73f554208b648dd6129364fc84c to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Check redirect destinations work on the dev site
SITE_URL="http://localhost:1313"
# Start the test server
docker-compose up -d
# Wait for the test server to start up
until $(curl --output /dev/null --silent --head --fail $SITE_URL/); do
printf '.'
sleep 1
done
while read -r _ new_url; do
curl --output /dev/null --silent --head --fail $SITE_URL$new_url
if [ $? -ne 0 ]; then
echo "$new_url - $(tput setaf 1)bad$(tput sgr0)"
else
echo "$new_url - $(tput setaf 10)okay$(tput sgr0)"
fi
done < src/static/_redirects
docker-compose down
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment