Ignore:
Timestamp:
07/26/06 15:20:28 (18 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/datacenter/scripts
Files:
2 edited

Legend:

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

    r7486 r7806  
    4848source /home/$user/Mars/datacenter/scripts/sourcefile
    4949
     50set -C
     51
    5052cd $mars
     53
     54program=filesondisk
     55
     56lockfile=$lockpath/lock-$program.txt
     57
     58scriptlogpath=$logpath/run/$program/`date +%Y`
     59makedir $scriptlogpath
     60scriptlog=$scriptlogpath/$program-$datetime.log
     61
     62date >> $scriptlog 2>&1
     63
     64# check if script is already running
     65checklock  >> $scriptlog 2>&1
     66
    5167date=`date +%F`
    5268
    5369subsystemdir=/magic/subsystemdata
    54 filesondisklogpath=$logpath/filesondisk/`date +%Y`
     70filesondisklogpath=$logpath/$program/`date +%Y/%m`
    5571makedir $filesondisklogpath
    5672
    5773
    58 echo "checking disk for ccfiles..."
    59 filename=$filesondisklogpath/ccfilesondisk-$date.txt
     74echo "checking disk for ccfiles..."  >> $scriptlog 2>&1
     75filename=$filesondisklogpath/ccfilesondisk-$datetime.txt
    6076column=fCCFileAvail
    6177find $subsystemdir/cc/ -name '*_S.rep' | cut -d_ -f2  > $filename
    6278
    63 echo "resetting runs..."
    64 check3=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$date.log | grep int | sed -e 's/(int)//'`
     79echo "resetting runs..." >> $scriptlog 2>&1
     80check3=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$datetime.log | grep int | sed -e 's/(int)//'`
    6581
    6682case $check3 in
    67    1)   echo "check3=$check3 -> everything ok -> reset is done";;
    68    *)   echo "check3=$check3 -> ERROR -> something went wrong while resetting";;
     83   1)   echo "check3=$check3 -> everything ok -> reset is done" >> $scriptlog 2>&1 ;;
     84   *)   echo "check3=$check3 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1 ;;
    6985esac
    7086
    7187
    72 echo "checking disk for cacofiles..."
    73 filename=$filesondisklogpath/cacofilesondisk-$date.txt
     88echo "checking disk for cacofiles..."  >> $scriptlog 2>&1
     89filename=$filesondisklogpath/cacofilesondisk-$datetime.txt
    7490column=fCaCoFileAvail
    7591find $subsystemdir/caco/ -name '*.txt' | cut -d_ -f8 | grep [0-9] > $filename
    7692
    77 echo "resetting runs..."
    78 check0=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$date.log | grep int | sed -e 's/(int)//'`
     93echo "resetting runs..." >> $scriptlog 2>&1
     94check0=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$datetime.log | grep int | sed -e 's/(int)//'`
    7995
    8096case $check0 in
    81    1)   echo "check0=$check0 -> everything ok -> reset is done";;
    82    *)   echo "check0=$check0 -> ERROR -> something went wrong while resetting";;
     97   1)   echo "check0=$check0 -> everything ok -> reset is done" >> $scriptlog 2>&1 ;;
     98   *)   echo "check0=$check0 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1 ;;
    8399esac
    84100
    85 echo "checking missing cacofiles..."
    86 check1=`root -q -b $macrospath/findcacofiles.C+\("\"$date\""\,"\"$filesondisklogpath\""\) | tee $filesondisklogpath/findcacofiles-$date.log | grep int | sed -e 's/(int)//'`
     101echo "checking missing cacofiles..." >> $scriptlog 2>&1
     102check1=`root -q -b $macrospath/findcacofiles.C+\("\"$date\""\,"\"$filesondisklogpath\""\) | tee $filesondisklogpath/findcacofiles-$datetime.log | grep int | sed -e 's/(int)//'`
    87103
    88104case $check1 in
    89    1)   echo "check1=$check1 -> everything ok -> missing cacofiles are found";;
    90    *)   echo "check1=$check1 -> ERROR -> something went wrong while resetting";;
     105   1)   echo "check1=$check1 -> everything ok -> missing cacofiles are found" >> $scriptlog 2>&1 ;;
     106   *)   echo "check1=$check1 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1 ;;
    91107esac
    92108
     
    95111do
    96112   runno=$missingcacorun
    97    echo "no cacofile found for run "$runno
    98    echo "finding cacofile"
     113   echo "no cacofile found for run "$runno >> $scriptlog 2>&1
     114   echo "finding cacofile" >> $scriptlog 2>&1
    99115   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`   
    100    echo "ccfile: "$ccfile
     116   echo "ccfile: "$ccfile  >> $scriptlog 2>&1
    101117   if [ "$ccfile" = "" ]
    102118   then
    103       echo "no ccfile found for run "$runno
     119      echo "no ccfile found for run "$runno >> $scriptlog 2>&1
    104120      continue
    105121   fi
     
    114130         continue
    115131      else
    116          echo "inserting cacofile $file for run $missingcacorun..."
     132         echo "inserting cacofile $file for run $missingcacorun..." >> $scriptlog 2>&1
    117133         check2=`root -q -b $macrospath/insertcacofile.C+\("\"$runno\""\,"\"$newrun\""\) | tee $filesondisklogpath/insertcacofile-$missingcacorun.log | grep int | sed -e 's/(int)//'`
    118134
    119135         case $check2 in
    120             1)   echo "check2=$check2 -> everything ok -> insert is done";;
    121             *)   echo "check2=$check2 -> ERROR -> something went wrong while inserting run "$missingcacorun;;
     136            1)   echo "check2=$check2 -> everything ok -> insert is done" >> $scriptlog 2>&1 ;;
     137            *)   echo "check2=$check2 -> ERROR -> something went wrong while inserting run "$missingcacorun >> $scriptlog 2>&1 ;;
    122138         esac
    123139         break
    124140      fi
    125141   done
    126    echo "cacofile: "$cacofile
     142   echo "cacofile: "$cacofile >> $scriptlog 2>&1
    127143
    128144done
    129145
    130146
    131 echo "checking disk for rawfiles..."
    132 filename=$filesondisklogpath/rawfilesondisk-$date.txt
     147echo "checking disk for rawfiles..."  >> $scriptlog 2>&1
     148filename=$filesondisklogpath/rawfilesondisk-$datetime.txt
    133149column=fRawFileAvail
    134150find $datapath -name '*.raw' -o -name '*.gz' | cut -d_ -f2 > $filename
    135151
    136 echo "resetting runs..."                                  
    137 check4=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$date.log | grep int | sed -e 's/(int)//'`
     152echo "resetting runs..." >> $scriptlog 2>&1
     153check4=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$datetime.log | grep int | sed -e 's/(int)//'`
    138154
    139155case $check4 in
    140    1)   echo "check4=$check4 -> everything ok -> reset is done";;
    141    *)   echo "check4=$check4 -> ERROR -> something went wrong while resetting";;
     156   1)   echo "check4=$check4 -> everything ok -> reset is done" >> $scriptlog 2>&1 ;;
     157   *)   echo "check4=$check4 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1 ;;
    142158esac
    143159
     160finish >> $scriptlog 2>&1
    144161
     162
  • trunk/MagicSoft/Mars/datacenter/scripts/movingrawfiles

    r7805 r7806  
    3030#
    3131
     32user=`whoami`
     33source /home/$user/Mars/datacenter/scripts/sourcefile
     34
     35set -C
     36
     37program=movingrawfiles
     38
     39lockfile=$lockpath/lock-$program.txt
     40
     41scriptlogpath=$logpath/run/$program/`date +%Y`
     42makedir $scriptlogpath
     43scriptlog=$scriptlogpath/$program-$datetime.log
     44
     45date >> $scriptlog 2>&1
     46
     47# check if script is already running
     48checklock  >> $scriptlog 2>&1
     49
     50
    3251umask 0002
    3352
    3453# change permission for files
    35 ssh tape@dc07 chmod -R g+w /magic/datacenter/fromtape/rawdata/*
     54ssh tape@dc07 chmod -R g+w /magic/datacenter/fromtape/rawdata/* >> $scriptlog 2>&1
    3655# output for chmod with -v or -c (only changes)
    3756
    3857#find directories, which have to be copied
    3958dirs=`ls /magic/datacenter/fromlapalma/RAWchk/*/*.finished | sed -e 's/RAWchk/RAW/g' | cut -d/ -f1-6`
    40 # change permission for this dirctories
    41 ssh lapalma@apollo chmod -R g+w $dirs
    42 # move directories to the tapedirectory
    43 mv -v $dirs /magic/datacenter/fromtape/rawdata/
     59if [ ! "$dirs" == "" ]
     60then
     61   # change permission for this dirctories
     62   ssh lapalma@apollo chmod -R g+w $dirs >> $scriptlog 2>&1
     63   # move directories to the tapedirectory
     64   mv -v $dirs /magic/datacenter/fromtape/rawdata/ >> $scriptlog 2>&1
     65fi
    4466
    4567
    4668# find rawfiles
    4769rawfiles=`find /magic/datacenter/fromtape/rawdata/ -name '*.*'`
     70
     71if [ "$rawfiles" == "" ]
     72then
     73   echo "no files to move -> exit" >> $scriptlog 2>&1
     74   finish >> $scriptlog 2>&1
     75fi
     76
    4877for rawfile in $rawfiles
    4978do
     
    5281   newrawfile=`echo $rawfile | sed -e 's/center\/fromtape\/rawdata/\/rawfiles/g' -e 's/_/\//1' -e 's/_/\//1'`
    5382   newdir=`dirname $newrawfile`
    54    if [ ! -d $newdir ]
    55    then
    56      mkdir -pv $newdir
    57      if [ ! -d $newdir ]
    58      then
    59         echo "could not make dir "$newdir
    60         exit
    61      fi
    62    fi
     83   makedir $newdir >> $scriptlog 2>&1
    6384
    64    mv -v $rawfile $newrawfile
    65 #   if gzip -1c $rawfile > $newrawfile.gz
    66 #   then
    67 #      rm -v $newrawfile
    68 #      rm -v $rawfile
    69 #   fi
     85   mv -v $rawfile $newrawfile >> $scriptlog 2>&1
    7086done
    7187
    72 rmdir -v /magic/datacenter/fromtape/rawdata/*
     88rmdir -v /magic/datacenter/fromtape/rawdata/* >> $scriptlog 2>&1
    7389
     90echo "launching filesondisk" >> $scriptlog 2>&1
     91$scriptspath/filesondisk&
     92
     93finish >> $scriptlog 2>&1
     94
Note: See TracChangeset for help on using the changeset viewer.