Ignore:
Timestamp:
08/12/08 10:20:17 (16 years ago)
Author:
snruegam
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r9093 r9114  
    1919#
    2020#   Author(s): Daniela Dorner  09/2006 <mailto:dorner@astro.uni-wuerzburg.de>
     21#   Author(s): Stefan Ruegamer 08/2008 <mailto:snruegam@astro.uni-wuerzburg.de>
    2122#
    2223#   Copyright: MAGIC Software Development, 2000-2007
     
    5556for file in ${files[@]}
    5657do
    57    echo "processing file $file..." >> $scriptlog 2>&1
     58   if ! [ -f $file ]
     59   then
     60      continue
     61   fi
     62   
     63   echo -e "\nprocessing file $file..." >> $scriptlog 2>&1
    5864   runno=`basename $file | sed -e 's/.*20[01][0-9]\{5\}_\(M[12]_\)\?.*\([0-9]\{8\}\).\([0-9]\{3\}\)\?.*/\2/'`
    5965   fileno=`basename $file | sed -e 's/.*20[01][0-9]\{5\}_\(M[12]_\)\?.*\([0-9]\{8\}\).\([0-9]\{3\}\)\?.*/\3/'`
     
    6975      telno=1
    7076   fi
     77   
     78   # get the sequence corresponding to the run
    7179   query="SELECT fSequenceFirst FROM RunData WHERE fRunNumber="$runno" AND fFileNumber="$fileno" AND fTelescopeNumber="$telno
    72    echo " sending query: $query" >> $scriptlog 2>&1 
     80   echo " sending query: $query" >> $scriptlog 2>&1
    7381   if ! seq=`sendquery`
    7482   then
    75       echo "querying seq for run M_${telno}${runno}.${fileno} from the db did not work -> continue" >> $scriptlog 2>&1
    76       printprocesslog "WARN query $seq for run M_${telno}${runno}.${fileno} from the db did not work"
     83      echo "querying seq for run M${telno}_${runno}.${fileno} from the db did not work -> continue" >> $scriptlog 2>&1
     84      printprocesslog "WARN query $seq for run M${telno}_${runno}.${fileno} from the db did not work"
    7785      continue
    7886   fi
    79    if [ "$seq" == "" ]
     87   if [ "$seq" == "" ] || [ "$seq" == "0" ]
    8088   then
    81       echo "no seq found for run M_${telno}${runno}.${fileno} -> locking only run..." >> $scriptlog 2>&1
    82       seq=$runno
     89      echo "no seq found for run M${telno}_${runno}.${fileno} -> locking only run..." >> $scriptlog 2>&1
     90      seq=${runno}.${fileno}
    8391   fi
    84    echo "locking sequence $seq..."  >> $scriptlog 2>&1
     92   
     93   # lock the sequence against zipscript
     94   echo "locking sequence ${seq}-${telno}..."  >> $scriptlog 2>&1
    8595   lockfile=$lockpath/calzip${seq}-${telno}.txt
    8696   checklock continue >> $scriptlog 2>&1
    87    query="UPDATE SequenceProcessStatus set fNotZipping=NULL WHERE fSequenceFirst=$seq"
    88    echo " sending query: $query" >> $scriptlog 2>&1
     97   
     98   # lock the run in the db
     99   query="UPDATE SequenceProcessStatus set fNotZipping=NULL WHERE fSequenceFirst=$seq AND fTelescopeNumber=$telno"
     100   echo " sending query: $query" >> $scriptlog 2>&1
    89101   if ! sendquery
    90102   then
    91       echo "locking $seq for callisto in db did not work ..." >> $scriptlog 2>&1
    92       printprocesslog "WARN locking $seq for callisto in db did not work"
     103      echo "locking ${seq}-${telno} for callisto in db did not work ..." >> $scriptlog 2>&1
     104      printprocesslog "WARN locking ${seq}-${telno} for callisto in db did not work"
    93105      rm -v $lockfile >> $scriptlog 2>&1
    94106      continue
    95107   fi
     108   
     109   # zip the run
    96110   echo "zipping $file ..." >> $scriptlog 2>&1
    97111   if ssh -xn phoenix nice -n 19 gzip -1f $file >> $scriptlog 2>&1
     
    102116      printprocesslog "WARN zipping $file did not work"
    103117   fi
    104    echo "unlocking sequence $seq..."  >> $scriptlog 2>&1
    105    query="UPDATE SequenceProcessStatus set fNotZipping=Now() WHERE fSequenceFirst=$seq"
    106    echo " sending query: $query" >> $scriptlog 2>&1
     118   
     119   # unlock the sequence in the db
     120   echo "unlocking sequence ${seq}-${telno}..."  >> $scriptlog 2>&1
     121   query="UPDATE SequenceProcessStatus set fNotZipping=Now() WHERE fSequenceFirst=$seq AND fTelescopeNumber=$telno"
     122   echo " sending query: $query" >> $scriptlog 2>&1
    107123   if ! sendquery
    108124   then
    109       echo "unlocking $seq for callisto in db did not work ..." >> $scriptlog 2>&1
    110       printprocesslog "ERROR unlocking $seq for callisto in db did not work"
     125      echo "unlocking ${seq}-${telno} for callisto in db did not work ..." >> $scriptlog 2>&1
     126      printprocesslog "ERROR unlocking ${seq}-${telno} for callisto in db did not work"
    111127      rm -v $lockfile >> $scriptlog 2>&1
    112128      continue
Note: See TracChangeset for help on using the changeset viewer.