Ignore:
Timestamp:
08/25/06 22:09:49 (18 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/datacenter/scripts/copyscript

    r7938 r7944  
    5757#
    5858
     59source `dirname $0`/sourcefile
     60printprocesslog "INFO starting $0"
    5961program=copyscript
    60 source `dirname $0`/sourcefile
    6162
    6263set -C
     
    6768char=24
    6869datetime=`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 
     70lockfile=$lockpath/lock-$program.txt
     71
     72scriptlog=$runlogpath/$program-$datetime.log
    7673date >> $scriptlog 2>&1
    7774
     
    8784then
    8885   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
    9287else
    9388   echo "checkfile created" >> $scriptlog 2>&1
     
    109104then
    110105   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
    114107fi
    115108
     
    118111for date in ${dates[@]}
    119112do
     113   printprocesslog "INFO processing files for $date"
    120114   #find all files for this date
    121115   files=`find $transdir/*/$date/ -name "*.*"`  >> $scriptlog 2>&1
     
    129123   
    130124   date2=`echo $date | sed -e 's/_/\//g'`
    131    copylogpath=$logpath/copyscript/$date2
     125   copylogpath=$logpath/$program/$date2
    132126   echo "copylogpath: "$copylogpath >> $scriptlog 2>&1
    133127   makedir $copylogpath >> $scriptlog 2>&1
     
    155149            checkfillrbk=`root -q -b $macrospath/filldotrbk.C+\("\"$file\""\,kFALSE\) | tee $copylogpath/filldotrbk-$filename-log.txt | grep int | sed -e 's/(int)//'`
    156150            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                  ;;
    161158            esac
    162159         fi
     
    166163            checkfillrun=`root -q -b $macrospath/filldotrun.C+\("\"$file\""\,kFALSE\) | tee $copylogpath/filldotrun-$filename-log.txt  | grep int | sed -e 's/(int)//'`
    167164            case $checkfillrun in
    168                1) echo "checkfillrun=$checkfillrun -> everything ok " >> $scriptlog 2>&1
    169                   echo "-> insert date in SequenceBuildStatus for $date" >> $scriptlog 2>&1
     165               1) echo " checkfillrun=$checkfillrun -> everything ok " >> $scriptlog 2>&1
     166                  echo "  -> insert date in SequenceBuildStatus for $date" >> $scriptlog 2>&1
    170167
    171168                  checkinsertdate=`root -q -b $macrospath/insertdate.C+\("\"$date\""\) | tee $copylogpath/insertdate-$date-log.txt   | grep int | sed -e 's/(int)//'`
    172169                  case $checkinsertdate in
    173170                     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                        ;;
    176175                  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                  ;;
    180182            esac
    181183         fi
     
    189191         else
    190192            echo $file" couldn't be moved!!!!!" >> $scriptlog 2>&1
     193            printprocesslog "WARN moving of file $file didn't work"
    191194         fi
    192195
     
    195198         #already processed (entry in donelist) -> go on with next file
    196199         echo $file": checksum not ok " >> $scriptlog 2>&1
     200         printprocesslog "WARN checksum for file $file is not ok"
    197201      fi
    198202   done
     
    208212#second part of the script:
    209213#update the catalog file magic_favorites.edb
    210 
     214printprocesslog "INFO processing new catalog files"
    211215magfav=magic_favorites.edb #catalog filename
    212216catalog=$setuppath/$magfav #current catalogfile
     
    218222for catfile in ${catfiles[@]}
    219223do
     224   printprocesslog "INFO processing catalog file $catfile"
    220225   #write information into .diff
    221226   echo "diff $catfile $catalog" >| $diff
     
    240245         #inform $adrs about removed lines
    241246         nail -s 'catalogfile - removed lines' $adrs < $diff
    242          exit
     247         printprocesslog "NEWS catalog file: lines have been removed ($catfile)"
     248         finish >> $scriptlog 2>&1
    243249      fi
    244250     
     
    252258      then
    253259         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
    255262      fi
    256263      #rsync new catalogfile to current catalogfile
     
    258265      then
    259266         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
    261269      fi
    262270      #inform $adrs about changes
    263271      echo "file has been rsynced sucessfully -> sending email" >> $scriptlog 2>&1
    264272      nail -s 'new catalogfile installed - new lines'  $adrs < $diff
     273      printprocesslog "NEWS there are new lines in the catalogfile (see $catalog)"
    265274      continue
    266275   fi
     
    273282      #inform $adrs about removed lines
    274283      nail -s 'catalogfile - removed lines' $adrs < $diff
    275       exit
     284      printprocesslog "NEWS catalog file: lines have been removed ($catfile)"
     285      finish >> $scriptlog 2>&1
    276286   fi
    277287#   echo "nothing has changed ($catfile)"  >> $scriptlog 2>&1
    278288done
    279289
    280 
    281 rm -v $lockfile >> $scriptlog 2>&1
    282 date >> $scriptlog 2>&1
    283 
    284 set +C
     290finish >> $scriptlog 2>&1
     291
Note: See TracChangeset for help on using the changeset viewer.