Changeset 7455


Ignore:
Timestamp:
12/13/05 14:38:27 (19 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r7453 r7455  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20 2005/12/13 Daniela Dorner
     21
     22   * datacenter/scripts/copyscript:
     23     - added updating of catalogfile
     24
     25
     26
    2027 2005/12/12 Daniela Dorner
    2128
  • trunk/MagicSoft/Mars/datacenter/scripts/copyscript

    r7348 r7455  
    228228#rsync -av --delete $transdir/ $extern >> $scriptlog 2>&1
    229229
     230
     231
     232#second part of the script:
     233#update the catalog file magic_favorites.edb
     234
     235magfav=magic_favorites.edb #catalog filename
     236catalog=$setuppath/$magfav #current catalogfile
     237diff=$setuppath/.diff #file to store difference
     238#addresses to which the changes are sent
     239adrs="dorner@astro.uni-wuerzburg.de, tbretz@astro.uni-wuerzburg.de, hoehne@astro.uni-wuerzburg.de"
     240
     241#getting new catalogfiles
     242catfiles=`find $subsystempath/cc/ -name $magfav -cnewer $catalog | sort`
     243
     244for catfile in ${catfiles[@]}
     245do
     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
     302done
     303
     304
    230305rm -v $lockpath/lock-copyscript.txt >> $scriptlog 2>&1
    231306date >> $scriptlog 2>&1
Note: See TracChangeset for help on using the changeset viewer.