blob: f9fc80aee791aae4fbb33d57623146677f06c789 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
#!/bin/sh -e
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"
|