source: ror-farm/analog/analog-rotate-wrapper @ 274

Last change on this file since 274 was 274, checked in by kasey, 11 years ago

kasey : add analog-rotate-wrapper a wrapper to automate rorette logrotate and stats generation

  • Property svn:executable set to *
File size: 752 bytes
Line 
1#! /bin/sh
2
3DRY_MODE="no"
4
5EXTRACT_QUERY="SELECT projects.name,documents.id FROM documents,projects WHERE documents.project_id = projects.id AND documents.title LIKE 'Fréquentation' ;"
6SCRIPT_PATH="/root/ror-farm/analog/analog-stat-plainv2"
7DATABASE="admin_prod"
8
9if [ "x$1" == "x--dry-run" ] ;
10then
11    DRY_MODE="yes"
12fi
13
14RORETTE_LIST=$(echo "$EXTRACT_QUERY" | mysql --skip-column-names $DATABASE)
15#COMMAND_LIST=$(echo "$RORETTE_LIST" | awk 'BEGIN{FS="\t"}{printf("/root/ror-farm/analog/analog-stat-plainv2 %s %s | mysql mysql_prod\n",$2,$1)}')
16
17echo "$RORETTE_LIST" | while read line ; do
18    if [ "$DRY_MODE" == "yes" ]
19    then
20        echo "$SCRIPT_PATH $line | mysql $DATABASE"
21    else
22        $SCRIPT_PATH $line | mysql $DATABASE
23    fi
24done
Note: See TracBrowser for help on using the repository browser.