Changeset 7806 for trunk/MagicSoft/Mars/datacenter/scripts
- Timestamp:
- 07/26/06 15:20:28 (18 years ago)
- Location:
- trunk/MagicSoft/Mars/datacenter/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/scripts/filesondisk
r7486 r7806 48 48 source /home/$user/Mars/datacenter/scripts/sourcefile 49 49 50 set -C 51 50 52 cd $mars 53 54 program=filesondisk 55 56 lockfile=$lockpath/lock-$program.txt 57 58 scriptlogpath=$logpath/run/$program/`date +%Y` 59 makedir $scriptlogpath 60 scriptlog=$scriptlogpath/$program-$datetime.log 61 62 date >> $scriptlog 2>&1 63 64 # check if script is already running 65 checklock >> $scriptlog 2>&1 66 51 67 date=`date +%F` 52 68 53 69 subsystemdir=/magic/subsystemdata 54 filesondisklogpath=$logpath/ filesondisk/`date +%Y`70 filesondisklogpath=$logpath/$program/`date +%Y/%m` 55 71 makedir $filesondisklogpath 56 72 57 73 58 echo "checking disk for ccfiles..." 59 filename=$filesondisklogpath/ccfilesondisk-$date .txt74 echo "checking disk for ccfiles..." >> $scriptlog 2>&1 75 filename=$filesondisklogpath/ccfilesondisk-$datetime.txt 60 76 column=fCCFileAvail 61 77 find $subsystemdir/cc/ -name '*_S.rep' | cut -d_ -f2 > $filename 62 78 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)//'`79 echo "resetting runs..." >> $scriptlog 2>&1 80 check3=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$datetime.log | grep int | sed -e 's/(int)//'` 65 81 66 82 case $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 ;; 69 85 esac 70 86 71 87 72 echo "checking disk for cacofiles..." 73 filename=$filesondisklogpath/cacofilesondisk-$date .txt88 echo "checking disk for cacofiles..." >> $scriptlog 2>&1 89 filename=$filesondisklogpath/cacofilesondisk-$datetime.txt 74 90 column=fCaCoFileAvail 75 91 find $subsystemdir/caco/ -name '*.txt' | cut -d_ -f8 | grep [0-9] > $filename 76 92 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)//'`93 echo "resetting runs..." >> $scriptlog 2>&1 94 check0=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$datetime.log | grep int | sed -e 's/(int)//'` 79 95 80 96 case $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 ;; 83 99 esac 84 100 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)//'`101 echo "checking missing cacofiles..." >> $scriptlog 2>&1 102 check1=`root -q -b $macrospath/findcacofiles.C+\("\"$date\""\,"\"$filesondisklogpath\""\) | tee $filesondisklogpath/findcacofiles-$datetime.log | grep int | sed -e 's/(int)//'` 87 103 88 104 case $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 ;; 91 107 esac 92 108 … … 95 111 do 96 112 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 99 115 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 101 117 if [ "$ccfile" = "" ] 102 118 then 103 echo "no ccfile found for run "$runno 119 echo "no ccfile found for run "$runno >> $scriptlog 2>&1 104 120 continue 105 121 fi … … 114 130 continue 115 131 else 116 echo "inserting cacofile $file for run $missingcacorun..." 132 echo "inserting cacofile $file for run $missingcacorun..." >> $scriptlog 2>&1 117 133 check2=`root -q -b $macrospath/insertcacofile.C+\("\"$runno\""\,"\"$newrun\""\) | tee $filesondisklogpath/insertcacofile-$missingcacorun.log | grep int | sed -e 's/(int)//'` 118 134 119 135 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 ;; 122 138 esac 123 139 break 124 140 fi 125 141 done 126 echo "cacofile: "$cacofile 142 echo "cacofile: "$cacofile >> $scriptlog 2>&1 127 143 128 144 done 129 145 130 146 131 echo "checking disk for rawfiles..." 132 filename=$filesondisklogpath/rawfilesondisk-$date .txt147 echo "checking disk for rawfiles..." >> $scriptlog 2>&1 148 filename=$filesondisklogpath/rawfilesondisk-$datetime.txt 133 149 column=fRawFileAvail 134 150 find $datapath -name '*.raw' -o -name '*.gz' | cut -d_ -f2 > $filename 135 151 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)//'`152 echo "resetting runs..." >> $scriptlog 2>&1 153 check4=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$datetime.log | grep int | sed -e 's/(int)//'` 138 154 139 155 case $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 ;; 142 158 esac 143 159 160 finish >> $scriptlog 2>&1 144 161 162 -
trunk/MagicSoft/Mars/datacenter/scripts/movingrawfiles
r7805 r7806 30 30 # 31 31 32 user=`whoami` 33 source /home/$user/Mars/datacenter/scripts/sourcefile 34 35 set -C 36 37 program=movingrawfiles 38 39 lockfile=$lockpath/lock-$program.txt 40 41 scriptlogpath=$logpath/run/$program/`date +%Y` 42 makedir $scriptlogpath 43 scriptlog=$scriptlogpath/$program-$datetime.log 44 45 date >> $scriptlog 2>&1 46 47 # check if script is already running 48 checklock >> $scriptlog 2>&1 49 50 32 51 umask 0002 33 52 34 53 # change permission for files 35 ssh tape@dc07 chmod -R g+w /magic/datacenter/fromtape/rawdata/* 54 ssh tape@dc07 chmod -R g+w /magic/datacenter/fromtape/rawdata/* >> $scriptlog 2>&1 36 55 # output for chmod with -v or -c (only changes) 37 56 38 57 #find directories, which have to be copied 39 58 dirs=`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/ 59 if [ ! "$dirs" == "" ] 60 then 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 65 fi 44 66 45 67 46 68 # find rawfiles 47 69 rawfiles=`find /magic/datacenter/fromtape/rawdata/ -name '*.*'` 70 71 if [ "$rawfiles" == "" ] 72 then 73 echo "no files to move -> exit" >> $scriptlog 2>&1 74 finish >> $scriptlog 2>&1 75 fi 76 48 77 for rawfile in $rawfiles 49 78 do … … 52 81 newrawfile=`echo $rawfile | sed -e 's/center\/fromtape\/rawdata/\/rawfiles/g' -e 's/_/\//1' -e 's/_/\//1'` 53 82 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 63 84 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 70 86 done 71 87 72 rmdir -v /magic/datacenter/fromtape/rawdata/* 88 rmdir -v /magic/datacenter/fromtape/rawdata/* >> $scriptlog 2>&1 73 89 90 echo "launching filesondisk" >> $scriptlog 2>&1 91 $scriptspath/filesondisk& 92 93 finish >> $scriptlog 2>&1 94
Note:
See TracChangeset
for help on using the changeset viewer.