Ignore:
Timestamp:
08/25/06 22:09:49 (18 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/datacenter/scripts/filesondisk

    r7938 r7944  
    4646
    4747source `dirname $0`/sourcefile
     48printprocesslog "INFO starting $0"
     49program=filesondisk
    4850
    4951set -C
    5052
    51 cd $mars
    52 
    53 program=filesondisk
    54 
    55 lockfile=$lockpath/lock-$program.txt
    56 
    57 scriptlogpath=$runlogpath/$program
    58 makedir $scriptlogpath
    59 scriptlog=$scriptlogpath/$program-$datetime.log
    60 
     53scriptlog=$runlogpath/$program-$datetime.log
    6154date >> $scriptlog 2>&1
    6255
    6356# check if script is already running
     57lockfile=$lockpath/lock-$program.txt
    6458checklock  >> $scriptlog 2>&1
    6559
    66 date=`date +%F`
     60filesondisklogpath=$logpath/$program/`date +%Y/%m`
     61makedir $filesondisklogpath >> $scriptlog 2>&1
    6762
    68 subsystemdir=/magic/subsystemdata
    69 filesondisklogpath=$logpath/$program/`date +%Y/%m`
    70 makedir $filesondisklogpath
    71 
     63cd $mars
    7264
    7365echo "checking disk for ccfiles..."  >> $scriptlog 2>&1
     66printprocesslog "INFO checking ccfiles"
    7467filename=$filesondisklogpath/ccfilesondisk-$datetime.txt
    7568column=fCCFileAvail
    76 find $subsystemdir/cc/ -name '*_S.rep' | cut -d_ -f2  > $filename
     69find $subsystempath/cc/ -name '*_S.rep' | cut -d_ -f2  > $filename
    7770
    7871echo "resetting runs..." >> $scriptlog 2>&1
     
    8073
    8174case $check3 in
    82    1)   echo "check3=$check3 -> everything ok -> reset is done" >> $scriptlog 2>&1 ;;
    83    *)   echo "check3=$check3 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1 ;;
     75   1)   echo " check3=$check3 -> everything ok -> reset is done" >> $scriptlog 2>&1
     76        printprocesslog "INFO ccfiles resetted successfully"
     77        ;;
     78   0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1
     79        printprocesslog "WARN connection to DB failed"
     80        ;;
     81   *)   echo " check3=$check3 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1
     82        printprocesslog "ERROR resettallruns.C failed for ccfiles"
     83        ;;
    8484esac
    8585
    8686
    8787echo "checking disk for cacofiles..."  >> $scriptlog 2>&1
     88printprocesslog "INFO checking cacofiles"
    8889filename=$filesondisklogpath/cacofilesondisk-$datetime.txt
    8990column=fCaCoFileAvail
    90 find $subsystemdir/caco/ -name '*.txt' | cut -d_ -f8 | grep [0-9] > $filename
     91find $subsystempath/caco/ -name '*.txt' | cut -d_ -f8 | grep [0-9] > $filename
    9192
    9293echo "resetting runs..." >> $scriptlog 2>&1
     
    9495
    9596case $check0 in
    96    1)   echo "check0=$check0 -> everything ok -> reset is done" >> $scriptlog 2>&1 ;;
    97    *)   echo "check0=$check0 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1 ;;
     97   1)   echo " check0=$check0 -> everything ok -> reset is done" >> $scriptlog 2>&1
     98        printprocesslog "INFO cacofiles resetted successfully"
     99        ;;
     100   0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1
     101        printprocesslog "WARN connection to DB failed"
     102        ;;
     103   *)   echo " check0=$check0 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1
     104        printprocesslog "ERROR resettallruns.C failed for cacofiles"
     105        ;;
    98106esac
    99107
     108date=`date +%F`
    100109echo "checking missing cacofiles..." >> $scriptlog 2>&1
     110printprocesslog "INFO checking missing cacofiles"
    101111check1=`root -q -b $macrospath/findcacofiles.C+\("\"$date\""\,"\"$filesondisklogpath\""\) | tee $filesondisklogpath/findcacofiles-$datetime.log | grep int | sed -e 's/(int)//'`
    102112
    103113case $check1 in
    104    1)   echo "check1=$check1 -> everything ok -> missing cacofiles are found" >> $scriptlog 2>&1 ;;
    105    *)   echo "check1=$check1 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1 ;;
     114   1)   echo " check1=$check1 -> everything ok -> missing cacofiles are found" >> $scriptlog 2>&1
     115        printprocesslog "INFO missing cacofiles found"
     116        ;;
     117   0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1
     118        printprocesslog "WARN connection to DB failed"
     119        ;;
     120   *)   echo " check1=$check1 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1
     121        printprocesslog "ERROR findcacofiles.C failed"
     122        ;;
    106123esac
    107124
     125printprocesslog "INFO finding missing cacofiles"
    108126missingcacoruns=(`cat $filesondisklogpath/findcacofiles-$date.txt`)
    109127for missingcacorun in ${missingcacoruns[@]}
     
    112130   echo "missing cacofile for run "$runno >> $scriptlog 2>&1
    113131   echo "-> finding cacofile" >> $scriptlog 2>&1
    114    ccfile=`find $subsystemdir/cc/ -name [2][0][0-2][0-9][0,1][0-9][0-3][0-9]_*${runno}_[P,D,C,S]_*_S.rep` 2>/dev/null
     132   ccfile=`find $subsystempath/cc/ -name [2][0][0-2][0-9][0,1][0-9][0-3][0-9]_*${runno}_[P,D,C,S]_*_S.rep` 2>/dev/null
    115133   echo " ccfile: "$ccfile  >> $scriptlog 2>&1
    116134   if [ "$ccfile" = "" ]
     
    129147         continue
    130148      else
     149         printprocesslog "INFO inserting cacofile for run $missingcacorun"
    131150         echo " inserting cacofile $file for run $missingcacorun..." >> $scriptlog 2>&1
    132151         check2=`root -q -b $macrospath/insertcacofile.C+\("\"$runno\""\,"\"$newrun\""\) | tee $filesondisklogpath/insertcacofile-$missingcacorun.log | grep int | sed -e 's/(int)//'`
    133152
    134153         case $check2 in
    135             1)   echo " check2=$check2 -> everything ok -> insert is done" >> $scriptlog 2>&1 ;;
    136             *)   echo " check2=$check2 -> ERROR -> something went wrong while inserting run "$missingcacorun >> $scriptlog 2>&1 ;;
     154            1)   echo " check2=$check2 -> everything ok -> insert is done" >> $scriptlog 2>&1
     155                 printprocesslog "INFO inserted $missingcacorun successfully"
     156                 ;;
     157            0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1
     158                 printprocesslog "WARN connection to DB failed"
     159                 ;;
     160            *)   echo " check2=$check2 -> ERROR -> something went wrong while inserting run "$missingcacorun >> $scriptlog 2>&1
     161                 printprocesslog "ERROR insertcacofile.C failed for run $missingcacorun"
     162                 ;;
    137163         esac
    138164         break
     
    142168   then
    143169      echo " no cacofile found for run "$runno >> $scriptlog 2>&1
     170      printprocesslog "WARN no cacofile found for run $runno"
    144171   else
    145172      echo " cacofile: "$cacofile >> $scriptlog 2>&1
     
    149176
    150177echo "checking disk for rawfiles..."  >> $scriptlog 2>&1
     178printprocesslog "INFO checking rawfiles"
    151179filename=$filesondisklogpath/rawfilesondisk-$datetime.txt
    152180column=fRawFileAvail
    153 find $datapath -name '*.raw' -o -name '*.gz' | cut -d_ -f2 > $filename
     181find $datapath/rawfiles -name '*.raw' -o -name '*.gz' | cut -d_ -f2 > $filename
    154182
    155183echo "resetting runs..." >> $scriptlog 2>&1
     
    157185
    158186case $check4 in
    159    1)   echo "check4=$check4 -> everything ok -> reset is done" >> $scriptlog 2>&1 ;;
    160    *)   echo "check4=$check4 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1 ;;
     187   1)   echo " check4=$check4 -> everything ok -> reset is done" >> $scriptlog 2>&1
     188        printprocesslog "INFO rawfiles resetted successfully"
     189        ;;
     190   0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1
     191        printprocesslog "WARN connection to DB failed"
     192        ;;
     193   *)   echo " check4=$check4 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1
     194        printprocesslog "ERROR resettallruns.C failed for rawfiles"
     195        ;;
    161196esac
    162197
    163198finish >> $scriptlog 2>&1
    164199
    165 
Note: See TracChangeset for help on using the changeset viewer.