Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:14:27

0001 #!/bin/bash
0002 
0003 workdir=`dirname $0`
0004 cd $workdir
0005 
0006 subdet=strip
0007 [ "c$1" != "c" ] && subdet=$1
0008 
0009 if [ "c${CMSSW_RELEASE_BASE}" == "c" ]; then
0010     echo -e "\nSetting scramv1 runtime"
0011     cd /afs/cern.ch/cms/sw/slc4_ia32_gcc345/cms/cmssw/CMSSW_1_6_0
0012     eval `scramv1 runtime -sh`
0013     cd -
0014 fi
0015 export TNS_ADMIN=/afs/cern.ch/project/oracle/admin
0016 
0017 [ ! -e log ] && mkdir log
0018 
0019 dblist=(`echo "select distinct db from DBtags ;" | sqlite3 dbfile.db`)
0020 accountlist=(`echo "select distinct account from DBtags where account like \"%$subdet%\" order by account;" | sqlite3 dbfile.db` )
0021 
0022 
0023 nc=${#dblist[@]}
0024 nr=${#accountlist[@]}
0025 
0026 #echo $nc $nr
0027 
0028 ir=0
0029 for account in ${accountlist[@]}
0030   do
0031   ic=0
0032   for db in ${dblist[@]}
0033     do
0034     let comp=$ir*$nc+$ic
0035     value[$comp]=`echo "select count(tag) from DBtags where (db='$db' and account='$account') ;" | sqlite3 dbfile.db`
0036     
0037     file=log/TagList_for_${db}_${account}.txt
0038     echo -e "DB:\t\t$db\nAccount:\t$account\n\ntags\n-----------------------" > $file
0039     echo "select tag from DBtags where (db='$db' and account='$account') ;" | sqlite3 dbfile.db>> $file
0040     #echo
0041     let ic=$ic+1
0042     done
0043   let ir=$ir+1
0044 done
0045 
0046 #echo ${value[@]}
0047 echo -e "\t\t\t ${dblist[@]}"
0048 
0049 export value
0050 
0051 ir=0
0052 while [ $ir -lt $nr ];
0053   do
0054   let start=$ir*$nc
0055   let stop=$start+$nc
0056   echo -e "${accountlist[$ir]} \t\t ${value[@]:$start:$nc}"
0057   let ir=$ir+1
0058 done
0059 
0060 
0061 export webadd="http://test"
0062 export htmlpath=`echo $webpath | sed -e "s@/data1@$webadd@"`
0063 
0064 webdir=/afs/cern.ch/user/g/giordano/WWW/MonitorCondDBSiStripAccount
0065 webfile=$webdir/table_$subdet.html
0066 webfiletmp=tmptest.html
0067 
0068 rm -f ${webfiletmp}*
0069     
0070 
0071     #Header
0072 echo "<html><head><title>Summary Page $vTag</title></head>" > ${webfiletmp}
0073 
0074 #echo "<h2>Summary Page for tag $vTag</h2>&nbsp;&nbsp;&nbsp; list of uploaded IOVs: <a href=$htmlpath/O2ORuns.txt>here </a><br><br>" #>> ${webfiletmp}
0075 #echo "<HR>" #>>  $webfiletmp
0076 
0077 echo "<TABLE  BORDER=1 ALIGN=CENTER> " > ${webfiletmp}
0078 
0079 echo ${dblist[@]} | awk 'BEGIN{stringa=" <TD align=center>"} function addColumn(value){stringa=sprintf("%s <TD align=center> %s",stringa,value) } {
0080 for(i=1;i<=NF;++i) addColumn($i);} END{print stringa "<TR>"}'  >> ${webfiletmp}
0081 
0082 
0083 ir=0
0084 while [ $ir -lt $nr ];
0085   do
0086   let start=$ir*$nc
0087   let stop=$start+$nc
0088   echo -e "${accountlist[$ir]} ${value[@]:$start:$nc} ${dblist[@]}" | awk 'function addColumn(value,filename,account){stringa=sprintf("%s <TD align=center> <a href=log/TagList_for_%s_%s.txt>%s</a>",stringa,filename,account,value) } {stringa=sprintf("<TD align=center>%s",$1); for(i=2;i<=(NF-1)/2+1;++i){j=i+NF/2-.5; addColumn($i,$j,$1);}} END{print stringa "<TR>"}' >> ${webfiletmp}
0089 
0090   let ir=$ir+1
0091 done
0092 
0093 
0094 
0095 #    echo -e "$tableSeparator  $tableSeparator Nsubmitted $tableSeparator Ncleared $tableSeparator EXIT CODE 0 $tableSeparator <a href=$sortedwebadd> Nevents </a><TR> " 
0096 
0097  #   echo -e "<TD><a href=$webpath/$dir> $dir </a>  $Separator  $fontColor $Ncreated </font>  $Separator $fontColor $Nsubmitted </font>  $Separator $fontColor  $Ncleared </font> $Separator $fontColor $Ndone </font> $tableSeparator $fontColor $Nevents </font> <TR> " | sed -e "s@hex@$color@g">> ${webfiletmp}_jobtable 
0098       
0099     echo "</TABLE> " >> ${webfiletmp}
0100 
0101 cp ${webfiletmp} ${webfile}
0102 cp -r log $webdir/.
0103