Ignore:
Timestamp:
02/08/08 12:56:38 (17 years ago)
Author:
snruegam
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r8682 r8857  
    1 #!/bin/sh
     1#!/bin/bash
    22#
    33# ========================================================================
     
    4646if [ ! -f $file ]
    4747then
    48         echo "tape $file not found -> aborting"
    49         exit
     48   echo "tape $file not found -> aborting"
     49   exit
    5050fi
    5151
    52 if [ ${checkpath}/tape_${id}.md5.lapalma ] || [ -f ${checkpath}/tape_${id}.md5.wue ]
     52if [ -f ${checkpath}/tape_${id}.md5.lapalma ] || [ -f ${checkpath}/tape_${id}.md5.wue ]
    5353then
    54         echo "Output files already existing. Are you sure you wish to continue (yes/no)?"
    55         read cont
    56         if [ ! $cont == "yes" ]
    57         then
    58                 echo "Aborting."
    59                 exit
    60         fi
     54   echo "Output files already existing. Are you sure you wish to continue (yes/no)?"
     55   read cont
     56   if [ ! $cont == "yes" ]
     57   then
     58      echo "Aborting."
     59      exit
     60   fi
    6161fi
    62        
     62
    6363date | tee ${checkpath}/tape_${id}.md5.lapalma | tee ${checkpath}/tape_${id}.md5.wue
    6464
     
    6666while read line
    6767do
    68         muxchk=`echo $line | cut -d/ -f1`
    69         # only check muxdata, not cc-, caco- or drivelog-files
    70         if [ "$muxchk" = "muxdata" ]
    71         then
    72                 sum=($line)
    73                 # reformat the files and checksums correctly and compare them
    74                 echo "${sum[1]}  ${sum[0]}" >> ${checkpath}/tape_${id}.md5.lapalma
    75                
    76                 ssh -nx phoenix nice -n 19 /opt/csw/bin/gmd5sum /magic/datacenter/fromtape/${sum[0]} | sed -e 's/\/magic\/datacenter\/fromtape\///' >> ${checkpath}/tape_${id}.md5.wue
    77                 #md5sum /magic/datacenter/fromtape/${sum[0]} | sed -e 's/\/magic\/datacenter\/fromtape\///' >> ${checkpath}/tape_${id}.md5.wue
    78         fi
     68   muxchk=`echo $line | cut -d/ -f1`
     69   type=`echo $line | cut -d_ -f7 | cut -c0-5`
     70   # only check muxdata rawfiles, not cc-, caco- or drivelog-files
     71   if [ "$muxchk" = "muxdata" ] && [ "$type" = "E.raw" ]
     72   then
     73      sum=($line)
     74     
     75      # check if the file has been extracted from tape; if not, don't write anything to the logfiles (so they can still be compared)
     76      if [ ! -f /magic/datacenter/fromtape/${sum[0]} ]
     77      then
     78        echo "File ${sum[0]} does not exist."
     79        continue
     80      fi
     81     
     82      # reformat the files and checksums correctly and compare them
     83      echo "${sum[1]}  ${sum[0]}" >> ${checkpath}/tape_${id}.md5.lapalma
     84     
     85      ssh -nx phoenix nice -n 19 /opt/csw/bin/gmd5sum /magic/datacenter/fromtape/${sum[0]} | sed -e 's/\/magic\/datacenter\/fromtape\///' >> ${checkpath}/tape_${id}.md5.wue
     86      #md5sum /magic/datacenter/fromtape/${sum[0]} | sed -e 's/\/magic\/datacenter\/fromtape\///' >> ${checkpath}/tape_${id}.md5.wue
     87   fi
    7988done < $file
    8089
     
    8392if [ ! -f ${checkpath}/tape_${id}.md5.lapalma ] || [ ! -f ${checkpath}/tape_${id}.md5.wue ]
    8493then
    85         echo "No output files written! Something went wrong... -> aborting"
    86         exit
     94   echo "No output files written! Something went wrong... -> aborting"
     95   exit
    8796fi
    8897
     
    95104if [ "$output" = "" ]
    96105then
    97         echo "All checksums are ok!"
     106   echo "All checksums are ok! Launching movingrawfiles now."# to be included
    98107else
    99         echo -e "The files are not identical! diff found the following differences:\n$output"
     108   echo -e "The files are not identical! diff found the following differences:\n$output"
    100109fi
    101110
Note: See TracChangeset for help on using the changeset viewer.