Skip to content

Instantly share code, notes, and snippets.

@glamrock
Created March 10, 2016 22:06
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 glamrock/b2975a0e9e88601cf3ef to your computer and use it in GitHub Desktop.
Save glamrock/b2975a0e9e88601cf3ef to your computer and use it in GitHub Desktop.
Check if list of sites are up or down
#!/bin/bash
# Down verification via dns/dig by Griffin ^_^
# basically the same thing as before, just running the "down" sites through dig
# to make sure they are really not available. Sites that pass this test
# are placed in a third site category, as they may be unavailable or blocked in
# the test location, but have defined nameservers in DNS records.
readarray -t array < sitesdown.txt
for i in "${array[@]}"
do (
if [[ $(dig @8.8.8.8 +short NS "$i") ]]
then echo "$i" >> sitemeh.txt
fi
)
done
#!/bin/bash
# Up/Down checker by Griffin ^_^
# Run both with the following command (making sure to change the folder name):
# find ~/by -type d -exec sh -c 'cd "{}" ; ~/by/sitesup.sh ;' \;
readarray -t array < *seeds.txt
for i in "${array[@]}"
do (
if curl -s --head --request GET "$i" | grep -E '200|300|301|302' > /dev/null
then echo "$i" >> sitesup.txt
else echo "$i" >> sitesdown.txt
fi
)
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment