source: modipsl/trunk/util/script_log_analyse @ 1580

Last change on this file since 1580 was 1579, checked in by mmaipsl, 13 years ago

This script gives an analyse of LAST configuration from mod.def downloaded by model
command.

It will create shell variables :

  • Property svn:executable set to *
  • Property svn:keywords set to Date,Author,Revision
File size: 3.5 KB
Line 
1#!/bin/ksh
2
3#**************************************************************
4# Author: Martial Mancip
5# Contact: Martial.Mancip__at__ipsl.jussieu.fr
6# $Revision::                                          $ Revision of last commit
7# $Author::                                            $ Author of last commit
8# $Date::                                              $ Date of last commit
9# IPSL (2006)
10#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
11#
12#**************************************************************
13
14# Documentation :
15# This script gives an analyse of LAST configuration from mod.def downloaded by model command.
16#
17# It will create shell variables :
18# The list of components of the configuration : ModelComponents / NbComponents
19# And for each components :
20# - The tags or branch name : ModelTags
21# - The version control system name : ModelSystems
22# - The version control server address and login : ModelServers
23# - The version control server directory for this version : ModelDirectories
24# - The modipsl local directory : ModelLocalDirs
25
26
27typeset sizelog thedate logfile mymodel i  NbModelCommands NbModelNames
28
29logfile=${MODIPSL}/util/log
30
31set -A ListModelCommands -- $( cat ${logfile} | grep '\./model' | sed -e 's& &::&g')
32printDebugArray ListModelCommands
33
34NbModelCommands=${#ListModelCommands[@]}
35
36set -A ListModelNames -- $( cat ${logfile} | grep '\-\-\-\ Model' | sed -e 's&.*: *&&' )
37printDebugArray ListModelNames
38
39NbModelNames=${#ListModelNames[@]}
40
41if [ ${NbModelCommands} -ne ${NbModelNames} ] ; then
42    echo "Error with $0 script. number of model calls ${NbModelCommands} is not equal to model name ${NbModelNames} in util/log file."
43    exit 1
44fi
45
46set -A ListModelDates -- $( cat ${logfile} | grep '\./model' | sed -e 's&\ \./model .*&&' | sed -e 's&/&-&g' | sed -e 's& &_&g' )
47printDebugArray ListModelDates
48#set -A ListModelDates -- $( cat ${logfile} | grep '\./model' | sed -e 's&\ \./model .*&&' | sed -e 's&^\(.*\)&"\1"&g' | xargs date +%g-%m-%d_%R:%S -d )
49
50
51
52# We only use the last call to model here !
53(( ModelNum = NbModelCommands - 1 ))
54
55
56
57
58(( i = 0 ))
59for mymodel in ${ListModelNames[@]}; do
60    thedate=$( echo ${ListModelDates[$i]} | sed -e "s&_& &g" | sed -e "s&-&/&g")
61#    echo $model $i ${ListModelDates[$i]} $thedate
62    ListLineModels[$i]=$( grep -ni "${thedate}" ${logfile} | sed -e "s&^\([0-9]*\):.*&\1&" )
63    (( i = i + 1 ))
64done
65printDebugArray ListLineModels
66
67sizelog=$( wc -l ${logfile} | sed -e 's&^\([0-9]*\).*&\1&' )
68
69LastModelFile=log_${ModelNum}
70tail --lines=$(( sizelog - ListLineModels[${ModelNum}] + 1 )) ${logfile} > ${LastModelFile}
71
72set -A ModelComponents -- $( cat ${LastModelFile} | grep '\-\-\-\ Component *: ' | sed -e 's&--- Component *: \(.*\)&\1&' )
73printDebugArray ModelComponents
74
75NbComponents=${#ModelComponents[@]}
76
77set -A ModelTags -- $( cat ${LastModelFile} | grep '\-\-\-\ Tag *: ' | sed -e 's&--- Tag *: \(.*\)&\1&' )
78printDebugArray ModelTags
79
80set -A ModelSystems -- $( cat ${LastModelFile} | grep '\-\-\-\ System *: ' | sed -e 's&--- System *: \(.*\)&\1&' )
81printDebugArray ModelSystems
82
83set -A ModelServers -- $( cat ${LastModelFile} | grep '\-\-\-\ Server *: ' | sed -e 's&--- Server *: \(.*\)&\1&' )
84printDebugArray ModelServers
85
86set -A ModelDirectories -- $( cat ${LastModelFile} | grep '\-\-\-\ Directory *: ' | sed -e 's&--- Directory *: \(.*\)&\1&' )
87printDebugArray ModelDirectories
88
89set -A ModelLocalDirs -- $( cat ${LastModelFile} | grep '\-\-\-\ Local Dir *: ' | sed -e 's&--- Local Dir *: \(.*\)&\1&' )
90printDebugArray ModelLocalDirs
91
92rm ${LastModelFile}
93rm ${logfile}
Note: See TracBrowser for help on using the repository browser.