README attempts to be more helpful.
[clqr.git] / count-downloads.sh
blob6439d1ed2994dc3a929500183627d68ad2d3d94a
1 #! /bin/bash
3 for FILE
4 in clqr-a4-consec.pdf clqr-a4-booklet-all.pdf clqr-a4-booklet-four.pdf \
5 clqr-letter-consec.pdf clqr-letter-booklet-all.pdf clqr-letter-booklet-four.pdf \
6 clqr.tar.gz
7 do
8 if [[ /home/groups/clqr/log/combined.prev.log \
9 -nt /home/groups/clqr/htdocs/counters/${FILE}.all-time-counter ]];
10 then
11 touch /home/groups/clqr/htdocs/counters/${FILE}.all-time-counter; # in case it didn't exist
12 echo $(( `cat /home/groups/clqr/htdocs/counters/${FILE}.all-time-counter` \
13 + \
14 `grep --count -e "GET /${FILE} .* 200 " \
15 /home/groups/clqr/log/combined.prev.log` )) \
16 > /home/groups/clqr/htdocs/counters/${FILE}.all-time-counter
18 echo `grep --count -e "GET /${FILE} .* 200 " \
19 /home/groups/clqr/log/combined.curr.log` \
20 > /home/groups/clqr/htdocs/counters/${FILE}.week-counter
22 echo $(( `cat /home/groups/clqr/htdocs/counters/${FILE}.all-time-counter` + \
23 `cat /home/groups/clqr/htdocs/counters/${FILE}.week-counter` )) \
24 > /home/groups/clqr/htdocs/counters/${FILE}.current-counter
25 done