Changeset 7455 for trunk/MagicSoft/Mars/datacenter/scripts
- Timestamp:
- 12/13/05 14:38:27 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/scripts/copyscript
r7348 r7455 228 228 #rsync -av --delete $transdir/ $extern >> $scriptlog 2>&1 229 229 230 231 232 #second part of the script: 233 #update the catalog file magic_favorites.edb 234 235 magfav=magic_favorites.edb #catalog filename 236 catalog=$setuppath/$magfav #current catalogfile 237 diff=$setuppath/.diff #file to store difference 238 #addresses to which the changes are sent 239 adrs="dorner@astro.uni-wuerzburg.de, tbretz@astro.uni-wuerzburg.de, hoehne@astro.uni-wuerzburg.de" 240 241 #getting new catalogfiles 242 catfiles=`find $subsystempath/cc/ -name $magfav -cnewer $catalog | sort` 243 244 for catfile in ${catfiles[@]} 245 do 246 #write information into .diff 247 echo "file: "$catfile > $diff 248 diff $catalog $catfile >> $diff 249 #getting differences 250 ins=`cat $diff| grep '>'` #what has been inserted 251 outs=`cat $diff | grep '<'`#what has been removed 252 253 #check if lines have been inserted 254 if ! [ "$ins" == "" ] 255 then 256 echo "--> catalogfile: "$catfile >> $scriptlog 2>&1 257 echo "the following lines were added:" >> $scriptlog 2>&1 258 cat $diff | grep '>' >> $scriptlog 2>&1 259 260 #check if lines have been removed 261 if ! [ "$outs" == "" ] 262 then 263 echo "the following lines have been removed" >> $scriptlog 2>&1 264 cat $diff | grep '<' >> $scriptlog 2>&1 265 echo " -> please check the file $catfile" >> $scriptlog 2>&1 266 #inform $adr about removed lines 267 nail -s 'catalogfile - removed lines' $adrs < $diff 268 exit 269 fi 270 271 #getting date of new catalogfile from path 272 date=`echo $catfile | cut -d/ -f5-7 | sed -e 's/\///g'` 273 274 #rsync current catalogfile to directory with old catalogfiles including the date of the new catalogfile into the filename 275 if ! rsync -av $catalog $setuppath/oldcatalogs/$magfav.$date >> $scriptlog 2>&1 276 then 277 echo "could not do 'rsync -av $catalog $setuppath/oldcatalogs/$magfav.$date' -> exit" >> $scriptlog 2>&1 278 exit 279 fi 280 #rsync new catalogfile to current catalogfile 281 if ! rsync -av $catfile $catalog >> $scriptlog 2>&1 282 then 283 echo "could not do 'rsync -av $catfile $catalog' -> exit" >> $scriptlog 2>&1 284 exit 285 fi 286 #inform $adr about changes 287 echo "file has been rsynced sucessfully -> sending email" >> $scriptlog 2>&1 288 nail -s 'new catalogfile installed - new lines' $adrs < $diff 289 continue 290 fi 291 #check if lines have been removed 292 if ! [ "$outs" == "" ] 293 then 294 echo "the following lines have been removed" >> $scriptlog 2>&1 295 cat $diff | grep '<' >> $scriptlog 2>&1 296 echo " -> please check the file $catfile" >> $scriptlog 2>&1 297 #inform $adr about removed lines 298 nail -s 'catalogfile - removed lines' $adrs < $diff 299 exit 300 fi 301 # echo "nothing has changed ($catfile)" >> $scriptlog 2>&1 302 done 303 304 230 305 rm -v $lockpath/lock-copyscript.txt >> $scriptlog 2>&1 231 306 date >> $scriptlog 2>&1
Note:
See TracChangeset
for help on using the changeset viewer.