From 5fbd3e4a4156a2c61d7f6e9a953c8dd0f4b1b341 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Thu, 21 Apr 2022 22:17:18 +0200 Subject: counter update, less retarded and probably opti --- src/cron/counter.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/cron/counter.sh b/src/cron/counter.sh index f9fc80a..fdc5f18 100755 --- a/src/cron/counter.sh +++ b/src/cron/counter.sh @@ -3,10 +3,7 @@ logfile='/var/log/nginx/access.log' destfile='/usr/local/www/jozan/index.html' foretext='Unique visitors: ' -tmp=$(mktemp) [ -e $logfile ] || exit 1 [ -e $destfile ] || exit 1 -sed "s/$foretext.*$/$foretext$(awk '{print $1}' $logfile | sort | uniq | wc -l | tr -d ' ')<\/b>/" $destfile >"$tmp" || rm "$tmp" -cat "$tmp" >$destfile -rm "$tmp" +sed -i '' "s/$foretext.*$/$foretext$(awk '{print $1}' $logfile | sort | uniq | wc -l | tr -d ' ')<\/b>/" $destfile -- cgit v1.2.3