Changeset 7944 for trunk/MagicSoft/Mars/datacenter/scripts/copyscript
- Timestamp:
- 08/25/06 22:09:49 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/scripts/copyscript
r7938 r7944 57 57 # 58 58 59 source `dirname $0`/sourcefile 60 printprocesslog "INFO starting $0" 59 61 program=copyscript 60 source `dirname $0`/sourcefile61 62 62 63 set -C … … 67 68 char=24 68 69 datetime=`date +%F-%H-%M-%S` 69 lockfile=$lockpath/lock-copyscript.txt 70 71 scriptlogpath=$runlogpath/$program 72 makedir $scriptlogpath 73 74 scriptlog=$scriptlogpath/copyscript-$datetime.log 75 70 lockfile=$lockpath/lock-$program.txt 71 72 scriptlog=$runlogpath/$program-$datetime.log 76 73 date >> $scriptlog 2>&1 77 74 … … 87 84 then 88 85 echo "couldn't create checkfile -> exit script" >> $scriptlog 2>&1 89 rm -v $lockfile >> $scriptlog 2>&1 90 date >> $scriptlog 2>&1 91 exit 86 finish >> $scriptlog 2>&1 92 87 else 93 88 echo "checkfile created" >> $scriptlog 2>&1 … … 109 104 then 110 105 echo "nothing to do -> exit" >> $scriptlog 2>&1 111 rm -v $lockfile >> $scriptlog 2>&1 112 date >> $scriptlog 2>&1 113 exit 106 finish >> $scriptlog 2>&1 114 107 fi 115 108 … … 118 111 for date in ${dates[@]} 119 112 do 113 printprocesslog "INFO processing files for $date" 120 114 #find all files for this date 121 115 files=`find $transdir/*/$date/ -name "*.*"` >> $scriptlog 2>&1 … … 129 123 130 124 date2=`echo $date | sed -e 's/_/\//g'` 131 copylogpath=$logpath/ copyscript/$date2125 copylogpath=$logpath/$program/$date2 132 126 echo "copylogpath: "$copylogpath >> $scriptlog 2>&1 133 127 makedir $copylogpath >> $scriptlog 2>&1 … … 155 149 checkfillrbk=`root -q -b $macrospath/filldotrbk.C+\("\"$file\""\,kFALSE\) | tee $copylogpath/filldotrbk-$filename-log.txt | grep int | sed -e 's/(int)//'` 156 150 case $checkfillrbk in 157 1) echo "checkfillrbk=$checkfillrbk -> everything ok " >> $scriptlog 2>&1 158 echo " -> go on with copying file" >> $scriptlog 2>&1 ;; 159 *) echo "checkfillrbk=$checkfillrbk - Error -> go on with next file" >> $scriptlog 2>&1 160 continue;; 151 1) echo " checkfillrbk=$checkfillrbk -> everything ok " >> $scriptlog 2>&1 152 echo " -> go on with copying file" >> $scriptlog 2>&1 153 ;; 154 *) echo " checkfillrbk=$checkfillrbk - Error -> go on with next file" >> $scriptlog 2>&1 155 printprocesslog "ERROR filldotrbk.C failed for $file" 156 continue 157 ;; 161 158 esac 162 159 fi … … 166 163 checkfillrun=`root -q -b $macrospath/filldotrun.C+\("\"$file\""\,kFALSE\) | tee $copylogpath/filldotrun-$filename-log.txt | grep int | sed -e 's/(int)//'` 167 164 case $checkfillrun in 168 1) echo " checkfillrun=$checkfillrun -> everything ok " >> $scriptlog 2>&1169 echo " -> insert date in SequenceBuildStatus for $date" >> $scriptlog 2>&1165 1) echo " checkfillrun=$checkfillrun -> everything ok " >> $scriptlog 2>&1 166 echo " -> insert date in SequenceBuildStatus for $date" >> $scriptlog 2>&1 170 167 171 168 checkinsertdate=`root -q -b $macrospath/insertdate.C+\("\"$date\""\) | tee $copylogpath/insertdate-$date-log.txt | grep int | sed -e 's/(int)//'` 172 169 case $checkinsertdate in 173 170 1) echo "date inserted" >> $scriptlog 2>&1 ;; 174 *) echo "checkinsertdate=$checkinsertdate -> ERROR - insert date didn't work" >> $scriptlog 2>&1 175 continue;; 171 *) echo " checkinsertdate=$checkinsertdate -> ERROR - insert date didn't work" >> $scriptlog 2>&1 172 printprocesslog "ERROR insertdate.C failed for $date" 173 continue 174 ;; 176 175 esac 177 echo " -> go on with copying file" >> $scriptlog 2>&1 ;; 178 *) echo "checkfillrun=$checkfillrun Error -> go on with next file" >> $scriptlog 2>&1 179 continue;; 176 echo " -> go on with copying file" >> $scriptlog 2>&1 177 ;; 178 *) echo " checkfillrun=$checkfillrun Error -> go on with next file" >> $scriptlog 2>&1 179 printprocesslog "ERROR filldotrun.C failed for $file" 180 continue 181 ;; 180 182 esac 181 183 fi … … 189 191 else 190 192 echo $file" couldn't be moved!!!!!" >> $scriptlog 2>&1 193 printprocesslog "WARN moving of file $file didn't work" 191 194 fi 192 195 … … 195 198 #already processed (entry in donelist) -> go on with next file 196 199 echo $file": checksum not ok " >> $scriptlog 2>&1 200 printprocesslog "WARN checksum for file $file is not ok" 197 201 fi 198 202 done … … 208 212 #second part of the script: 209 213 #update the catalog file magic_favorites.edb 210 214 printprocesslog "INFO processing new catalog files" 211 215 magfav=magic_favorites.edb #catalog filename 212 216 catalog=$setuppath/$magfav #current catalogfile … … 218 222 for catfile in ${catfiles[@]} 219 223 do 224 printprocesslog "INFO processing catalog file $catfile" 220 225 #write information into .diff 221 226 echo "diff $catfile $catalog" >| $diff … … 240 245 #inform $adrs about removed lines 241 246 nail -s 'catalogfile - removed lines' $adrs < $diff 242 exit 247 printprocesslog "NEWS catalog file: lines have been removed ($catfile)" 248 finish >> $scriptlog 2>&1 243 249 fi 244 250 … … 252 258 then 253 259 echo "could not do 'rsync -av $catalog $setuppath/oldcatalogs/$magfav.$date' -> exit" >> $scriptlog 2>&1 254 exit 260 printprocesslog "ERROR rsync of catalog file ($catalog -> $oldcatalogpath/$magfav.$date) didn't work" 261 finish >> $scriptlog 2>&1 255 262 fi 256 263 #rsync new catalogfile to current catalogfile … … 258 265 then 259 266 echo "could not do 'rsync -av $catfile $catalog' -> exit" >> $scriptlog 2>&1 260 exit 267 printprocesslog "ERROR rsync of catalog file ($catfile -> $catalog) didn't work" 268 finish >> $scriptlog 2>&1 261 269 fi 262 270 #inform $adrs about changes 263 271 echo "file has been rsynced sucessfully -> sending email" >> $scriptlog 2>&1 264 272 nail -s 'new catalogfile installed - new lines' $adrs < $diff 273 printprocesslog "NEWS there are new lines in the catalogfile (see $catalog)" 265 274 continue 266 275 fi … … 273 282 #inform $adrs about removed lines 274 283 nail -s 'catalogfile - removed lines' $adrs < $diff 275 exit 284 printprocesslog "NEWS catalog file: lines have been removed ($catfile)" 285 finish >> $scriptlog 2>&1 276 286 fi 277 287 # echo "nothing has changed ($catfile)" >> $scriptlog 2>&1 278 288 done 279 289 280 281 rm -v $lockfile >> $scriptlog 2>&1 282 date >> $scriptlog 2>&1 283 284 set +C 290 finish >> $scriptlog 2>&1 291
Note:
See TracChangeset
for help on using the changeset viewer.