Changeset 8234 for trunk/MagicSoft/Mars/datacenter/scripts/movingrawfiles
- Timestamp:
- 12/13/06 17:23:40 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/scripts/movingrawfiles
r7944 r8234 25 25 # ======================================================================== 26 26 # 27 # This script is moving the rawfiles from the directory 28 # /magic/datacenter/fromtape/rawdata to the structure 27 # This script is moving the rawfiles from the directory 28 # /magic/datacenter/fromtape/rawdata to the structure 29 29 # /magic/data/rawfiles/YYYY/MM/DD 30 30 # … … 40 40 date >> $scriptlog 2>&1 41 41 42 # check ifscript is already running42 # check whether script is already running 43 43 lockfile=$lockpath/lock-$program.txt 44 44 checklock >> $scriptlog 2>&1 45 45 46 # change permission for files 46 # change permission for files 47 47 ssh tape@dc07 chmod -R g+w /magic/datacenter/fromtape/rawdata/* >> $scriptlog 2>&1 48 48 # output for chmod with -v or -c (only changes) 49 49 50 50 printprocesslog "INFO moving directories from fromlapalma to fromtape" 51 #find directories ,which have to be copied51 #find directories which have to be copied 52 52 dirs=`ls /magic/datacenter/fromlapalma/RAWchk/*/*.finished | sed -e 's/RAWchk/RAW/g' | cut -d/ -f1-6` 53 53 if [ ! "$dirs" == "" ] 54 54 then 55 # change permission for this dirctories 56 ssh lapalma@apollo chmod -R g+w $dirs >> $scriptlog 2>&1 57 # move directories to the tapedirectory 58 mv -v $dirs /magic/datacenter/fromtape/rawdata/ >> $scriptlog 2>&1 55 for dir in $dirs 56 do 57 # get number of *.raw files from directory 58 numfiles=`find $dir -type f -name "*.raw" | wc -l` 59 60 # skip empty directories 61 if [ "$numfiles" == "0" ] 62 then 63 continue 64 fi 65 66 # get date from directory name 67 curdate=`echo $dir | cut -d/ -f6- | sed -e 's/_/-/g'` 68 69 getdbsetup 70 # get number of runs on this date from db 71 query="select COUNT(*) from RunData where ADDDATE(fRunStart, Interval 12 hour) like '$curdate %'" 72 73 if ! numruns=`mysql -s -u $us --password=$pw --host=hercules $db -e "$query" | tail -1` 74 then 75 echo "ERROR could not query number of runs from rundb -> continue" >> $scriptlog 2>&1 76 printprocesslog "ERROR could not query number of runs for $curdate from rundb" 77 continue 78 fi 79 80 # Check if number of runs matches. If not, skip this directory 81 if ! [ $numfiles -eq $numruns ] 82 then 83 echo "WARNING" >> $scriptlog 2>&1 84 echo "Expecting $numruns raw-files for $curdate but found only $numfiles" >> $scriptlog 2>&1 85 continue 86 fi 87 88 # check for non-raw-files 89 nonraw=`find $dir -type f ! -name "*.raw"` 90 if [ ! "$nonraw" == "" ] 91 then 92 echo "non-raw-files found in $dir" >> $scriptlog 2>&1 93 printprocesslog "WARNING non-raw-files found in $dir" 94 fi 95 96 # change permission for this directory 97 ssh lapalma@apollo chmod -R g+w $dir >> $scriptlog 2>&1 98 # move directories to the tapedirectory 99 mv -v $dir /magic/datacenter/fromtape/rawdata/ >> $scriptlog 2>&1 100 101 done 59 102 fi 60 103
Note:
See TracChangeset
for help on using the changeset viewer.