Skip to content

Instantly share code, notes, and snippets.

@trabulium
Last active August 1, 2017 04:18
Show Gist options
  • Save trabulium/f445dfd01d4de4ebd267c8e5d2660c69 to your computer and use it in GitHub Desktop.
Save trabulium/f445dfd01d4de4ebd267c8e5d2660c69 to your computer and use it in GitHub Desktop.
#!/bin/bash
CHECKOUTS_IP=`/bin/grep saveOrder /var/log/httpd/access.log | grep -v "js\|media\|css\|skin" | awk {'print $1'} | sort | uniq -c | sort -rn | head -1 | awk {'print $2'}`
CHECKOUTS_QTY=`/bin/grep saveOrder /var/log/httpd/access.log | grep -v "js\|media\|css\|skin" | awk {'print $1'} | sort | uniq -c | sort -rn | head -1 | awk {'print $1'}`
CHECKOUTS_COUNTRY=`/usr/bin/geoiplookup $CHECKOUTS_IP | grep Country | awk {'print $5'}`
if [[ $CHECKOUTS_QTY -gt 4 && $CHECKOUTS_COUNTRY != "Australia" ]]
then
#echo $IPADDRESS
/usr/sbin/csf -d $CHECKOUTS_IP
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment