Last active
December 18, 2015 22:49
-
-
Save stansidel/5857642 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
result_file=$(mktemp -t "check_robots_final_XXXXX") | |
echo "# Checking servers..." | |
# Need to remove the Windows file endings | |
sites_file=$(mktemp -t "sites_XXXXXX") | |
sed 's/^M$//' /www/sitechecker/sites.txt > $sites_file | |
while read line; do | |
myfile=$(mktemp -t "check_robotsXXXXXXXXX") | |
printf "\t$line" | |
wget -O $myfile "$line/robots.txt" > /dev/null 2>&1 | |
if grep -q "^[^#]*Disallow: /\s*$" "$myfile"; then | |
echo "$line/robots.txt" >> $result_file | |
printf " <<<<<<< It has incorrect robots.txt!" | |
fi | |
printf "\n" | |
rm $myfile | |
done < "$sites_file" | |
rm $sites_file | |
if [ -s "$result_file" ] | |
then | |
echo "# Sending errors to emails" | |
mails=`cat /www/sitechecker/mails4external.txt` | |
/bin/mail -s "There are incorrect robots.txt on the WORKING servers!" "$mails" < $result_file | |
fi | |
rm $result_file | |
echo "# Done" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test.example.com | |
example.org | |
ya.ru | |
market.yandex.ru | |
google.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[email protected] [email protected] [email protected] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment