From 396e1b14f152ddd83eeed4827a70c253a11e9a05 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Tue, 19 Apr 2022 08:30:19 +0200 Subject: Smoother like this, changed url --- src/cron/counter.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/cron/counter.sh') diff --git a/src/cron/counter.sh b/src/cron/counter.sh index f3a7656..f9fc80a 100755 --- a/src/cron/counter.sh +++ b/src/cron/counter.sh @@ -5,6 +5,8 @@ destfile='/usr/local/www/jozan/index.html' foretext='Unique visitors: ' tmp=$(mktemp) -sed "s/$foretext.*$/$foretext$(awk '{print $1}' $logfile | sort | uniq | wc -l | tr -d ' ')/" $destfile >"$tmp" +[ -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" -- cgit v1.2.3