Changeset 7910


Ignore:
Timestamp:
08/22/06 15:08:12 (18 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r7909 r7910  
    4545     - added addresses
    4646     - implemented functions to get todolist via shell
     47     - improved logging
    4748
    4849   * datacenter/scripts/jobmanager:
     
    7980     - implemented usage of gettodo instead of getdolist (faster)
    8081
     82   * datacenter/scripts/dodatacheck:
     83     - improved logging and comments
     84     - adapted find-to-do-file-algorithm
    8185
    8286
  • trunk/MagicSoft/Mars/datacenter/scripts/dodatacheck

    r7909 r7910  
    2828# checked
    2929#
    30 # After checking, if the script is already running, the todolist is
    31 # written
     30# Get todo file
    3231# Then for each run the following steps are done:
    3332#  - filldotraw.C
     
    4039#
    4140
     41source `dirname $0`/sourcefile
    4242program=datacheck
    43 source `dirname $0`/sourcefile
     43column=fDataCheckDone
    4444
    4545set -C
    4646
    47 column=fDataCheckDone
    48 
    49 lockfile=$lockpath/lock-getting-$program-list.txt
    50 
    51 scriptlogpath=$logpath/run/$program/`date +%Y/%m`
     47scriptlogpath=$logpath/run/$program/`date +%Y/%m/%d`
    5248makedir $scriptlogpath
    5349scriptlog=$scriptlogpath/$program-$datetime.log
     
    5551date >> $scriptlog 2>&1
    5652
    57 # check if there are already todo files
    58 echo "checking if other todo-files are there" >> $scriptlog 2>&1
    59 if  ls $todofile-[1-9]*.txt >> $scriptlog 2>&1
     53# get todo file
     54possibletodofiles=`ls -r $listpath/ToDo-*-$column-*.txt` >> $scriptlog 2>&1
     55if [ "$possibletodofiles" = "" ]
    6056then
    61    echo "other file(s) on disk " >> $scriptlog 2>&1
    62    echo " -> choose one file and start $program " >> $scriptlog 2>&1
     57   echo "ERROR: in $program no todofiles found => something went wrong in jobmanager"
     58   finish >> $scriptlog 2>&1
    6359else
    64    # check if getting of list is already running
    65    checklock "getting list of" >> $scriptlog 2>&1
    66    # get todo list
    67    gettodolist  >> $scriptlog 2>&1
    68    rm -v $lockfile >> $scriptlog 2>&1
     60   singleprocess="yes"
     61   echo "todofiles: "${possibletodofiles[@]} >> $scriptlog 2>&1
     62   for possibletodofile in ${possibletodofiles[@]}
     63   do
     64      if ! ls $possibletodofile >> $scriptlog 2>&1
     65      then
     66         echo "file is not on disk -> continue" >> $scriptlog 2>&1
     67         continue
     68      fi
     69      lockfile=`echo $possibletodofile | sed -e 's/lists/locks/' -e 's/ToDo/lock/'`
     70      checklock >> $scriptlog 2>&1
     71      todofile=$possibletodofile
     72   done
    6973fi
    70 
    71 
    72 # finding a todo file
    73 nr=bla
    74 echo "finding the right todo-file" >> $scriptlog 2>&1
    75 todofiles=`ls -r $listpath/ToDo-$table-$column-*`
    76 
    77 echo "todofiles: "${todofiles[@]} >> $scriptlog 2>&1
    78 for todofile in ${todofiles[@]}
    79 do
    80    if ! ls $todofile >> $scriptlog 2>&1
    81    then
    82       echo "file is not on disk -> continue" >> $scriptlog 2>&1
    83       continue
    84    fi
    85    lockfile=`echo $todofile | sed -e 's/lists/locks/' -e 's/ToDo/lock/'`
    86    date > $lockfile >> $scriptlog 2>&1
    87    checklock=$?
    88    case $checklock in
    89        0)   echo "checklock=$checklock -> setting number" >> $scriptlog 2>&1
    90             nr=${i}
    91             break;;
    92        1)   echo "checklock=$checklock -> file exists -> continue" >> $scriptlog 2>&1;;
    93        *)   echo "checklock=$checklock -> something went completely wrong" >> $scriptlog 2>&1;;
    94    esac
    95 done
    96 
    97 case $nr in
    98    bla)      echo "everything is beeing processed -> exit" >> $scriptlog 2>&1
    99              date  >> $scriptlog 2>&1
    100              exit;;
    101    12345678) echo "process nr: "$nr >> $scriptlog 2>&1;;
    102 esac
    103 
     74if [ "$todofile" = "" ]
     75then
     76   echo "no todofile found -> exit"  >> $scriptlog 2>&1
     77   finish >> $scriptlog 2>&1
     78fi
    10479
    10580# get run(s) from todo file
     
    125100   echo "rawfile: "$rawfile >> $scriptlog 2>&1
    126101   date=`echo $rawfile | cut -c 22-31`
    127    echo "date: "$date >> $scriptlog 2>&1
    128102   # for sinope the date is needed in the format YYYY-MM-DD
    129103   date2=`echo $date | sed -e 's/\//-/g'`
    130    echo "date2: "$date2 >> $scriptlog 2>&1
     104
     105   setstatus "start" >> $scriptlog 2>&1
    131106
    132107   # running filldotraw
     108   echo "doing filldotraw..." >> $scriptlog 2>&1
    133109   filldotrawpath=$logpath/filldotraw/$date
    134110   makedir $filldotrawpath >> $scriptlog 2>&1
    135111   filldotrawlogfile=$filldotrawpath/filldotraw-$no2.log
    136112
    137    echo "doing filldotraw..." >> $scriptlog 2>&1
    138    setstatus "start" >> $scriptlog 2>&1
    139 
    140113   check1=`root -q -b $macrospath/filldotraw.C+\("\"$rawfile\""\,kFALSE\) | tee $filldotrawlogfile | grep int | sed -e 's/.*(int)//'`
    141114
    142115   case $check1 in
    143       1)   echo "check1=$check1 -> everything ok -> go on with $program..." >> $scriptlog 2>&1
     116      1)   echo " check1=$check1 -> everything ok -> go on with $program..." >> $scriptlog 2>&1
    144117           ;;
    145       0)   echo "check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1
     118      0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1
    146119           check="no"
    147120           setstatus "stop" >> $scriptlog 2>&1
    148121           continue ;;
    149       *)   echo "check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
     122      *)   echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
    150123           com=$Ffillraw
    151124           check=$check1
     
    159132   
    160133   sins=( "-dat"  "-cal")
    161    echo ${sins[@]} >> $scriptlog 2>&1
    162134   for sin in ${sins[@]}
    163135   do
    164136      sinopefile=sinope$sin$no2
    165       echo $sinopefile >> $scriptlog 2>&1
    166137     
    167138      echo "running sinope $sin..." >> $scriptlog 2>&1
     
    170141     
    171142      case $check2 in
    172           0)   echo "check2=$check2 -> everything ok -> go on with $program..." >> $scriptlog 2>&1
     143          0)   echo " check2=$check2 -> everything ok -> go on with $program..." >> $scriptlog 2>&1
    173144               ;;
    174           *)   echo "check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
     145          *)   echo " check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
    175146               com=$Fsinope
    176147#               comadd=
     
    191162
    192163   case $check3 in
    193       1)   echo "check3=$check3 -> everything ok -> set status..." >> $scriptlog 2>&1
     164      1)   echo " check3=$check3 -> everything ok -> set status..." >> $scriptlog 2>&1
    194165           ;;
    195       0)   echo "check3=$check3 -> no connection to db -> continue..." >> $scriptlog 2>&1
     166      0)   echo " check3=$check3 -> no connection to db -> continue..." >> $scriptlog 2>&1
    196167           check="no"
    197168           setstatus "stop" >> $scriptlog 2>&1
    198169           continue ;;
    199       *)   echo "check3=$check3 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
     170      *)   echo " check3=$check3 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
    200171           com=$Ffillsinope
    201172           check=$check3
     
    207178   echo "resetting the status for fExclusionsDone for date $date2" >> $scriptlog 2>&1
    208179   resetlogpath=$logpath/resetexclusions/$date
    209    echo "resetlogpath: $resetlogpath" >> $scriptlog 2>&1
    210180   makedir $resetlogpath >> $scriptlog 2>&1
    211181   resetlog=$resetlogpath/reset-exclusions-$no2-$date2.log
     
    213183   check5=`root -q -b $macrospath/resetcolumn.C+\("\"fExclusionsDone\""\,"\"SequenceBuildStatus\""\,"\"$date2\""\,"\"$date2\""\,kFALSE\) | tee $resetlog | grep int | sed -e 's/(int)//'`
    214184   case $check5 in
    215       1)   echo "check5=$check5 -> everything ok, fExclusions have been reset " >> $scriptlog 2>&1
     185      1)   echo " check5=$check5 -> everything ok, fExclusions have been reset " >> $scriptlog 2>&1
    216186           ;;
    217       0)   echo "check5=$check5 -> no connection to db -> continue..." >> $scriptlog 2>&1
     187      0)   echo " check5=$check5 -> no connection to db -> continue..." >> $scriptlog 2>&1
    218188           check="no"
    219189           setstatus "stop" >> $scriptlog 2>&1
    220190           continue ;;
    221       *)   echo "check5=$check5 -> ERROR -> step could not be resetted -> repeat step " >> $scriptlog 2>&1
     191      *)   echo " check5=$check5 -> ERROR -> step could not be resetted -> repeat step " >> $scriptlog 2>&1
    222192           com=$Fresetexcl
    223193           comadd=`echo $date2 | sed -e 's/-//g'`
     
    228198
    229199   # set status
    230    echo "inserting the status for the $program for run $run into the db" >> $scriptlog 2>&1
    231200   statustime="Now()"
    232201   failed="NULL"
  • trunk/MagicSoft/Mars/datacenter/scripts/sourcefile

    r7909 r7910  
    113113}
    114114
     115# function to do continue in a loop or exit the program depending on what is needed
     116function contex()
     117{
     118   echo ""
     119   if [ "$singleprocess" = "yes" ]
     120   then
     121      continue
     122   else
     123      exit
     124   fi
     125}
     126
    115127# function to make sure that a directory is made
    116128function makedir()
     
    133145   checklock0=$?
    134146   case $checklock0 in
    135        0)   echo "checklock0=$checklock0 -> continue " ;;
    136        1)   echo "checklock0=$checklock0 -> file $lockfile exists "
    137             echo "-> $@ $program is running -> exit"
     147       0)   echo " checklock0=$checklock0 -> continue " ;;
     148       1)   echo " checklock0=$checklock0 -> file $lockfile exists -> exit"
    138149            date
    139             exit;;
    140        *)   echo "checklock0=$checklock0 -> something went completely wrong" ;;
     150            contex;;
     151       *)   echo " checklock0=$checklock0 -> something went completely wrong" ;;
    141152   esac
    142153}
     
    158169
    159170   case $check0 in
    160       1)   echo "check0=$check0 -> everything ok, got todo list -> run $program";;
    161       *)   echo "check0=$check0 -> ERROR -> could not get todo list -> exit"
     171      1)   echo " check0=$check0 -> everything ok, got todo list -> run $program";;
     172      *)   echo " check0=$check0 -> ERROR -> could not get todo list -> exit"
    162173           finish ;;
    163174   esac
     
    194205   resetstatusvalues
    195206   case $@ in
    196       start)   echo "start"
     207      start)   echo "setstatus start"
    197208               starttime="Now()"
    198209               ;;
    199        stop)   echo "stop"
     210       stop)   echo "setstatus stop"
    200211               case $check in
    201212                 ok)  echo " ok"
     
    230241   checkstatus=`root -q -b $macrospath/setstatus.C+\("\"$var2\""\,"\"$table\""\,"\"$column\""\,"\"$statustime\""\,"\"$returncode\""\,"\"$failedcode\""\,"\"$failedcodeadd\""\,"\"$starttime\""\,"\"$failedtime\""\) | tee $setstatuslog | grep int | sed -e 's/(int)//'`
    231242   case $checkstatus in
    232       1)   echo "checkstatus=$checkstatus -> everything ok, status has been set";;
    233       *)   echo "checkstatus=$checkstatus -> ERROR -> step could not be set -> exit"
     243      1)   echo " checkstatus=$checkstatus -> everything ok, status has been set";;
     244      *)   echo " checkstatus=$checkstatus -> ERROR -> step could not be set -> exit"
    234245           finish ;;
    235246   esac
     
    262273#   echo " influences: $influences"
    263274#   echo " primary: $primary"
    264 }
    265 
    266 function contex()
    267 {
    268    echo ""
    269    if [ "$singleprocess" = "yes" ]
    270    then
    271       continue
    272    else
    273       exit
    274    fi
    275275}
    276276
Note: See TracChangeset for help on using the changeset viewer.