diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2022-04-18 02:50:08 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2022-04-18 02:50:08 +0200 |
commit | babbae0f6f2dd9d8744ff442595e751a24809acc (patch) | |
tree | 0331004f941cd2ff8ebcd217bbaf40e4e7b7471d /src/cron/counter.sh | |
parent | cube now public (diff) | |
download | joe-scripts-babbae0f6f2dd9d8744ff442595e751a24809acc.tar.gz joe-scripts-babbae0f6f2dd9d8744ff442595e751a24809acc.tar.bz2 joe-scripts-babbae0f6f2dd9d8744ff442595e751a24809acc.tar.xz joe-scripts-babbae0f6f2dd9d8744ff442595e751a24809acc.tar.zst joe-scripts-babbae0f6f2dd9d8744ff442595e751a24809acc.zip |
New script to count visitors on my website
Diffstat (limited to '')
-rwxr-xr-x | src/cron/counter.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cron/counter.sh b/src/cron/counter.sh new file mode 100755 index 0000000..f3a7656 --- /dev/null +++ b/src/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: ' +tmp=$(mktemp) + +sed "s/$foretext.*$/$foretext$(awk '{print $1}' $logfile | sort | uniq | wc -l | tr -d ' ')/" $destfile >"$tmp" +cat "$tmp" >$destfile +rm "$tmp" |