From 361b43dd712750acb2494f848a8102a442ff1f75 Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 6 May 2022 14:51:55 +0200 Subject: update --- cron/counter.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 cron/counter.sh (limited to 'cron/counter.sh') diff --git a/cron/counter.sh b/cron/counter.sh new file mode 100755 index 0000000..b75dd12 --- /dev/null +++ b/cron/counter.sh @@ -0,0 +1,10 @@ +#!/bin/sh -e + +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$(grep -E -v -i "$botlist" $logfile | awk '{print $1}' | sort | uniq | wc -l | tr -d ' ')<\/b>/" $destfile -- cgit v1.2.3