Changeset 222


Ignore:
Timestamp:
Sep 16, 2009, 3:52:43 PM (11 years ago)
Author:
lucas
Message:

redmine-proj: cleanup, less verbose outuput

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ror-farm/redmine/redmine-proj

    r213 r222  
    3636fi
    3737
    38 echo "-----------------------------------------------"
    3938while getopts :n:d:u:i:D: option
    4039do
    4140  case $option in
    42     n)
    43       echo "Nom rorette : $OPTARG"
    44       nom=$OPTARG
     41    n) nom=$OPTARG
    4542      ;;
    46     d)
    47       echo "Description : $OPTARG"
    48       desc=$OPTARG
     43    d) desc=$OPTARG
    4944      ;;
    50     u)
    51       echo "Adresse web : $OPTARG"
    52       url=$OPTARG
     45    u) url=$OPTARG
    5346      ;;
    54     i)
    55       echo "ID unique   : $OPTARG"
    56       uniqueID=$OPTARG
     47    i) uniqueID=$OPTARG
    5748      ;;
    58     D)
    59       echo "Database    : $OPTARG"
    60       DataBase=$OPTARG
     49    D) DataBase=$OPTARG
    6150      ;;
    6251  esac
    6352done
    64 echo "-----------------------------------------------"
    6553
    6654if [ -z "$DataBase" ]
    6755then
    6856  DataBase="$defaultDB"
    69   echo "Default : Database set : $defaultDB "
    70   echo "-----------------------------------------------"
    7157fi
    7258
    7359if [ -z "$nom" ]
    7460then
    75   echo "Error : Nom is empty"
     61  echo "Error: empty name"
    7662  usage
    77   echo "-----------------------------------------------"
    7863  exit 1
    7964fi
     
    8166if [ -z "$uniqueID" ]
    8267then
    83   echo "Error : Unique ID is empty"
     68  echo "Error: empty Unique ID"
    8469  usage
    85   echo "-----------------------------------------------"
    8670  exit 1
    8771fi
     
    9074if [ "$unique" != "0" ]
    9175then
    92   echo "Unique ID already exist"
    93   echo "-----------------------------------------------"
     76  echo "Error: Unique ID already exists"
    9477  exit 1
    9578fi
     
    10790idProject=`echo "SELECT id FROM projects ORDER BY id DESC LIMIT 1 ;" | mysql $DataBase -N -B `                                      # get last projet ID
    10891
    109 echo "Last module  ID   : $idModule"
    110 echo "Last project ID   : $idProject"
    111 echo "-----------------------------------------------"
     92idProject=$(( $idProject + 1 )) # increment projet ID
    11293
    113 idProject=$(( $idProject + 1 )) # increment projet ID
     94## Redmine
     95
     96echo "Creating project for rorette $nom..."
    11497
    11598echo "INSERT INTO projects VALUES ($idProject,'$nom','$desc','$url',0,NULL,0,'$now','$now','$uniqueID',1);" | mysql $DataBase -N -B # Create a new projet with the previously parameters passed
     
    129112idAttachements=`echo "SELECT id FROM attachments ORDER BY id DESC LIMIT 1 ;" | mysql $DataBase -N -B `                              # get last attachments ID
    130113
    131 echo "Last document  ID : $idDocument"
    132 echo "Last attachmentID : $idAttachements"
    133 echo "Visites doc ID    : $(($idDocument + 2))"
    134 echo "-----------------------------------------------"
    135 
    136114idDocument=$(( $idDocument + 1 ))         # document ID
    137115idAttachements=$(( $idAttachements + 1 )) # attachments ID
     
    143121
    144122# Load
    145 echo "Add attachments   : Load"
    146123echo "INSERT INTO attachments VALUES ($(( $idAttachements + 1)),$idDocument,'Document','board-load.png','${Fnow}06_board-load.png',20000,'image/png','561ec13ba1b97e345c5534262ef5aff5',0,1,'$now','');" | mysql $DataBase -N -B
    147124
    148125# Memory
    149 echo "Add attachments   : Memory"
    150126echo "INSERT INTO attachments VALUES ($(( $idAttachements + 2)),$idDocument,'Document','board-memory.png','${Fnow}16_board-memory.png',20000,'image/png','561ec13ba1b97e345c5534262ef5aff5',0,1,'$now','');" | mysql $DataBase -N -B
    151127
    152128# Proc
    153 echo "Add attachments   : Proc"
    154129echo "INSERT INTO attachments VALUES ($(( $idAttachements + 3)),$idDocument,'Document','board-proc.png','${Fnow}26_board-proc.png',20000,'image/png','561ec13ba1b97e345c5534262ef5aff5',0,1,'$now','');" | mysql $DataBase -N -B
    155130
    156131# Threads
    157 echo "Add attachments   : Threads"
    158132echo "INSERT INTO attachments VALUES ($(( $idAttachements + 4)),$idDocument,'Document','board-threads.png','${Fnow}36_board-threads.png',20000,'image/png','561ec13ba1b97e345c5534262ef5aff5',0,1,'$now','');" | mysql $DataBase -N -B
    159133
    160134# Traffic
    161 echo "Add attachments   : Traffic"
    162135echo "INSERT INTO attachments VALUES ($(( $idAttachements + 5)),$idDocument,'Document','board-traffic.png','${Fnow}46_board-traffic.png',20000,'image/png','561ec13ba1b97e345c5534262ef5aff5',0,1,'$now','');" | mysql $DataBase -N -B
    163 
    164 echo "-----------------------------------------------"
    165136
    166137# Create symbolic link
    167138cd /var/lib/vservers/admin/home/ror/site/prod/files
    168139# Load
    169 echo "Create link       : Load"
    170140ln -s /home/ror/monitoring/${nom}/board-load.png ${Fnow}06_board-load.png
    171141
    172142# Memory
    173 echo "Create link       : Memory"
    174143ln -s /home/ror/monitoring/${nom}/board-memory.png ${Fnow}16_board-memory.png
    175144
    176145# Proc
    177 echo "Create link       : Proc"
    178146ln -s /home/ror/monitoring/${nom}/board-proc.png ${Fnow}26_board-proc.png
    179147
    180148# Threads
    181 echo "Create link       : Threads"
    182149ln -s /home/ror/monitoring/${nom}/board-threads.png ${Fnow}36_board-threads.png
    183150
    184151# Traffic
    185 echo "Create link       : Traffic"
    186152ln -s /home/ror/monitoring/${nom}/board-traffic.png ${Fnow}46_board-traffic.png
    187 
    188 echo "-----------------------------------------------"
    189153
    190154idWiki=`echo "SELECT id FROM wikis ORDER BY id DESC LIMIT 1 ;" | mysql $DataBase -N -B `                                            # get last wikis ID
    191155idPage=`echo "SELECT id FROM wiki_pages ORDER BY id DESC LIMIT 1 ;" | mysql $DataBase -N -B `                                       # get last page of wiki ID
    192156idCont=`echo "SELECT id FROM wiki_contents ORDER BY id DESC LIMIT 1 ;" | mysql $DataBase -N -B `                                    # get last content of page ID
    193 
    194 echo "Last wiki ID      : $idWiki"
    195 echo "Last wiki page ID : $idPage"
    196 echo "Last wiki cont ID : $idCont"
    197157
    198158idWiki=$(( $idWiki + 1 )) # increment wiki ID
     
    202162echo "INSERT INTO wikis VALUES ($idWiki,$idProject,'ReadmeRoR',1) ;" | mysql $DataBase -N -B                                        # Create the wiki
    203163echo "INSERT INTO wiki_pages VALUES ($idPage,$idWiki,'ReadmeRoR','$now',0,NULL);" | mysql $DataBase -N -B                           # Create the main wiki page called ReadmeRoR
    204 #If you use Redmine 0.8 uncomment the previous ligne and comment the following line
     164
     165#If you use Redmine 0.8, uncomment the previous line and comment the following line
    205166#echo "INSERT INTO wiki_pages VALUES ($idPage,$idWiki,'ReadmeRoR','$now');" | mysql $DataBase -N -B                           # Create the main wiki page called ReadmeRoR
    206167echo "INSERT INTO wiki_contents (id,page_id,author_id,text,comments,updated_on,version) SELECT $idCont,$idPage,1,text,'','$now',1 FROM wiki_contents WHERE id=7;" | mysql $DataBase -N -B
    207168
    208 #### Analog ####################################################
     169echo "...done"
    209170
    210 echo "-----------------------------------------------"
     171## Analog
     172
     173echo "Adding analog stats"
    211174
    212175analog_conf=$report_dir/$nom.cfg
     
    219182sed -e "s|<rorette>|${nom}|g"             -i $analog_conf
    220183
    221 echo "Configuration file $analog_conf created"
    222 
    223184analog +g$analog_conf && $analog_dir/analogFilter -v id=$(($idDocument + 1)) $report_dir/${nom}.report | mysql $DataBase
    224 echo "Stats   upgraded"
    225185
    226186cat <<EOF   > /etc/cron.daily/analog-${nom}
     
    231191
    232192chmod +x /etc/cron.daily/analog-${nom}
    233 echo "Crontab updated"
    234193
    235 echo "-----------------------------------------------"
     194echo "...done"
Note: See TracChangeset for help on using the changeset viewer.