aboutsummaryrefslogtreecommitdiffstats
path: root/src/cron/counter.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xsrc/cron/counter.sh5
1 files changed, 1 insertions, 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<b>$(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<b>$(awk '{print $1}' $logfile | sort | uniq | wc -l | tr -d ' ')<\/b>/" $destfile