aboutsummaryrefslogtreecommitdiffstats
path: root/src/cron/counter.sh
diff options
context:
space:
mode:
authorJoe <bousset.rudy@gmail.com>2022-04-30 01:38:42 +0200
committerJoe <bousset.rudy@gmail.com>2022-04-30 01:42:07 +0200
commit035d0b30bba362d4db5ec6717c051f377ce654ee (patch)
tree26be165466533992d921f85035ea54a045c463be /src/cron/counter.sh
parentpush (diff)
downloadjoe-scripts-035d0b30bba362d4db5ec6717c051f377ce654ee.tar.gz
joe-scripts-035d0b30bba362d4db5ec6717c051f377ce654ee.tar.bz2
joe-scripts-035d0b30bba362d4db5ec6717c051f377ce654ee.tar.xz
joe-scripts-035d0b30bba362d4db5ec6717c051f377ce654ee.tar.zst
joe-scripts-035d0b30bba362d4db5ec6717c051f377ce654ee.zip
Added bot list to kill the bots
Diffstat (limited to '')
-rwxr-xr-xsrc/cron/counter.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cron/counter.sh b/src/cron/counter.sh
index fdc5f18..b75dd12 100755
--- a/src/cron/counter.sh
+++ b/src/cron/counter.sh
@@ -3,7 +3,8 @@
logfile='/var/log/nginx/access.log'
destfile='/usr/local/www/jozan/index.html'
foretext='Unique visitors: '
+botlist='petalbot|googlebot|adsbot-google|ahrefs\.com|pingbot|robots\.txt|pandalytics|serpstatbot|zoombot|semrush.com\/bot|archive\.org_bot|bingbot|vuhuvbot|neevabot|botaflatoon|botfnetowrksx|zaldamosearchbot|facebookexternalhit|mj12bot|polaris botnet|turnitinbot'
[ -e $logfile ] || exit 1
[ -e $destfile ] || exit 1
-sed -i '' "s/$foretext.*$/$foretext<b>$(awk '{print $1}' $logfile | sort | uniq | wc -l | tr -d ' ')<\/b>/" $destfile
+sed -i '' "s/$foretext.*$/$foretext<b>$(grep -E -v -i "$botlist" $logfile | awk '{print $1}' | sort | uniq | wc -l | tr -d ' ')<\/b>/" $destfile