Changeset 271


Ignore:
Timestamp:
Nov 15, 2009, 1:26:50 PM (11 years ago)
Author:
kasey
Message:

analog-stat-plainv2: various fixes to turn it into a working script (see #1210)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ror-farm/analog/analog-stat-plainv2

    r270 r271  
    99if [ "x$1" == "x" ] || [ "x$2" == "x" ] || [ "$1" == "--help" ] || [ "$1" == "-h" ] ; then
    1010        usage
    11         exit 1
     11        exit
    1212fi
    1313
     
    2828fi
    2929
    30 rm /var/lib/analog/${1}/cache.0
    31 mv /var/lib/analog/${1}/cache /var/lib/analog/${1}/cache.0
     30rorette=$1
     31id=$2
     32
     33mkdir -p /var/lib/analog/$rorette
     34# move old cache out of the way and prepare new cache
     35rm -f /var/lib/analog/$rorette/cache.0
     36if [ -f /var/lib/analog/$rorette/cache ] ; then
     37  mv /var/lib/analog/$rorette/cache /var/lib/analog/$rorette/cache.0
     38fi
     39
     40sql=$(analog -G +a"PLAIN" \
     41          +C"LANGUAGE FRENCH" \
     42          +C"CACHEOUTFILE /var/lib/analog/$rorette/cache" \
     43          +C"CACHEFILE /var/lib/analog/$rorette/cache.0" \
     44          +C"LOGFILE /var/lib/vservers/$rorette/home/ror/http/log/access.log" \
     45          | iconv -s --from-code=LATIN1 --to-code=UTF8)
    3246
    3347cat << EOF
    34 set names utf8;UPDATE documents SET description = "
     48SET NAMES utf8;
     49UPDATE documents SET description = "
    3550h2. Statistiques :
     51
    3652<pre>
    37 $(mv /var/lib/analog/${1}/cache /var/lib/analog/${1}/cache.$(date +"%Y%d%m") 2>/dev/null && \
    38 analog -G +a"COMPUTER" \
    39           +C"LANGUAGE FRENCH" \
    40           +C"CACHEOUTFILE /var/lib/analog/${1}/cache" \
    41           +C"CACHEFILE /var/lib/analog/${1}/cache.0" \
    42           +C"LOGFILE /var/lib/vservers/${1}/home/ror/http/log/access.log" 1>/dev/null \
    43           | iconv -s --from-code=LATIN1 --to-code=UTF8)
     53$sql
    4454</pre>
    45 " WHERE id = $2 ;
     55" WHERE title = 'Fréquentation' and project_id IN (SELECT id FROM projects WHERE name = '$rorette') ;
    4656EOF
Note: See TracChangeset for help on using the changeset viewer.