Changeset 8482


Ignore:
Timestamp:
05/09/07 17:05:15 (18 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
44 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/datacenter/macros/findcacofiles.C

    r7460 r8482  
    2828// ===============
    2929//
    30 // Macro to get from the database the number of the runs, for which no caco
    31 // file is available.
     30// Macro to find caco files for runs which don't have a dedicated caco file.
     31// Called by the script filesondisk
    3232//
    3333// Sometimes the DAQ aborts a run and starts itself a new one. In this cases
     
    3737// runnumber. To be able to merpp the information into the calibrated data
    3838// file, the runnumber of the file containing the information has to be found.
    39 // This is done by a script.
    40 // findcacofiles.C produces the input for this script. It queries from the
    41 // database, for which runs no caco file with the same runnumber is available
    42 // and writes the runnumbers into an txt file.
     39//
     40// findcacofiles.C searches in the database for runs which don't have a
     41// dedicated caco file, and searches for each of these runs, if one of the 10
     42// previous runs has a dedicated caco file. In case one is found, it is
     43// inserted into the database.
    4344//
    4445// Usage:
    45 //   .x findcacofiles.C+("date", "logpath")
    46 // date and logpath are needed only for the output file
     46//   .x findcacofiles.C+
    4747//
    4848// Make sure, that database and password are corretly set in a resource
     
    6060#include <TSystem.h>
    6161
    62 #include <MSQLServer.h>
     62#include "MSQLMagic.h"
    6363#include <TSQLRow.h>
    6464#include <TSQLResult.h>
     
    6767
    6868
    69 int findcacofiles(TString date, TString logpath)
     69int findcacofiles()
    7070{
    7171    TEnv env("sql.rc");
    7272
    73     MSQLServer serv(env);
     73    MSQLMagic serv(env);
    7474    if (!serv.IsConnected())
    7575    {
     
    8383    cout << endl;
    8484
    85     //get runnumbers from database
    86     TString query="SELECT RunProcessStatus.fRunNumber FROM RunProcessStatus ";
    87     query+=" LEFT JOIN RunData on RunData.fRunNumber=RunProcessStatus.fRunNumber ";
    88     query+=" WHERE IsNull(fCaCoFileFound) and fExcludedFDAKEY=1 ";
    89     query+=" and RunProcessStatus.fRunNumber > 10000 and not IsNull(fCCFileAvail)";
     85    //get runnumbers and dates from database
     86    TString query="SELECT RunProcessStatus.fRunNumber, ";
     87    query+=" DATE_FORMAT(ADDDATE(if(fRunStart='0000-00-00 00:00:00', fRunStop, fRunStart), INTERVAL +13 HOUR), '%Y/%m/%d') ";
     88    query+=" FROM RunProcessStatus ";
     89    query+=" LEFT JOIN RunData ON RunData.fRunNumber=RunProcessStatus.fRunNumber ";
     90    query+=" LEFT JOIN Source ON RunData.fSourceKEY=Source.fSourceKEY ";
     91    query+=" WHERE IsNull(fCaCoFileFound) AND fExcludedFDAKEY=1 ";
     92    query+=" AND RunProcessStatus.fRunNumber > 10000 AND NOT IsNull(fCCFileAvail)";
     93    query+=" AND fTest='no'";
    9094
    9195    TSQLResult *res = serv.Query(query);
     
    96100    }
    97101
    98     //create output file
    99     TString filename(Form("%s/findcacofiles-%s.txt", logpath.Data(), date.Data()));
    100     ofstream fout(filename, ios::app);
    101     if (!fout)
    102     {
    103         cout << "ERROR - Cannot open file " << filename << endl;
    104         return 0;
    105     }
    106 
    107     //write runnumbers into output file
     102    Int_t counter=0;
     103    Int_t counter2=0;
    108104    TSQLRow *row=0;
    109105    while ((row = res->Next()))
    110         fout << (*row)[0] << endl;
     106    {
     107        //search nearest previous available CaCoFile
     108        Int_t run=atoi((*row)[0]);
     109        if (TString((*row)[1]).IsNull())
     110        {
     111            cout << "For run " << (*row)[0] << " fRunStart and fRunStop are 0000-00-00 00:00:00. No CaCoFile can be determined. " << endl;
     112            continue;
     113        }
     114        cout << "CaCoFile missing for run " << (*row)[0] << " with date " << (*row)[1] << endl;
     115
     116        query ="SELECT MAX(fCaCoFileFound) FROM RunProcessStatus ";
     117        query+=" LEFT JOIN RunData ON RunData.fRunNumber=RunProcessStatus.fRunNumber ";
     118        query+=Form("WHERE DATE_FORMAT(ADDDATE(fRunStart, INTERVAL +13 HOUR), '%%Y/%%m/%%d')='%s' ",
     119                    (*row)[1]);
     120        query+=Form("AND RunData.fRunNumber IN (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)",
     121                    run, run-1, run-2, run-3, run-4, run-5,
     122                    run-6, run-7, run-8, run-9, run-10);
     123
     124        TSQLResult *res2 = serv.Query(query);
     125        if (!res2)
     126        {
     127            cout << "Error." << endl;
     128            return 0;
     129        }
     130        TSQLRow *row2=0;
     131        row2 = res2->Next();
     132        if ((*row2)[0])
     133        {
     134            cout << "Found CaCoFile at run " << (*row2)[0] << endl;
     135            TString vals=Form("fCaCoFileAvail=Now(), fCaCoFileFound=%s", (*row2)[0]);
     136            TString where=Form("fRunNumber=%d", run);
     137
     138            //insert found runnumber
     139            if (!serv.Update("RunProcessStatus", vals,where))
     140                return 0;
     141            counter2+=1;
     142        }
     143        else
     144            cout << " No caco file found for run " << run << endl;
     145
     146        delete res2;
     147        counter+=1;
     148    }
     149    cout << endl << counter << " missing caco files. " << endl;
     150    cout << counter2 << " caco files found and inserted. " << endl;
    111151
    112152    delete res;
  • trunk/MagicSoft/Mars/datacenter/scripts/buildsequenceentries

    r7954 r8482  
    2020#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    3232# macro buildsequenceentries.C
    3333# If this was successful, the status is inserted into the database using
    34 # the macro setstatus.C
     34# the function setstatus.
    3535#
    3636
     
    6969   printprocesslog "INFO build sequence entries for $date"
    7070   year2=`echo $date | cut -c 1-4`
    71    var1=$year2
    72    var2=$date
    7371   buildsequentriespath=$logpath/$program/$year2
    7472   makedir  $buildsequentriespath >> $scriptlog 2>&1
    7573   buildsequentrieslog=$buildsequentriespath/buildsequenceentries-$date.log
    7674
     75   primvar=$date
    7776   setstatus "start" >> $scriptlog 2>&1
    7877
  • trunk/MagicSoft/Mars/datacenter/scripts/checkfilesforsequenceavail

    r7982 r8482  
    2020#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    3232# checked by using the macro checkfilesavail.C
    3333# If this was successful, the status is inserted into the database using
    34 # the macro setstatus.C
     34# the function setstatus.
    3535#
    3636
     
    6868   no=`printf %08d $sequence | cut -c 0-4`
    6969   no2=`printf %08d $sequence`
    70    var1=$no
    71    var2=$no2
    7270   checkfileavailpath=$logpath/$program/$no
    7371   makedir $checkfileavailpath  >> $scriptlog 2>&1
     
    7674   sequencefile=$sequpath/$no/sequence$no2.txt
    7775
     76   primvar=$no2
    7877   setstatus "start" >> $scriptlog 2>&1
    7978
  • trunk/MagicSoft/Mars/datacenter/scripts/checklogs

    r8058 r8482  
    2020#   Author(s): Daniela Dorner  08/2006 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
  • trunk/MagicSoft/Mars/datacenter/scripts/checkstardone

    r7954 r8482  
    2020#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    3333# the macro checkstardone.C
    3434# If this was successful, the status is inserted into the database using
    35 # the macro setstatus.C
     35# the function setstatus.
    3636#
    3737
     
    6868   no=`printf %08d $dataset | cut -c 0-5`
    6969   no2=`printf %08d $dataset`
    70    var1=$no
    71    var2=$dataset
    7270   datasetfile=$datasetpath/$no/dataset`printf %08d $dataset`.txt
    7371   
     
    8482   makedir $outpath  >> $scriptlog 2>&1
    8583   
     84   primvar=$dataset
    8685   setstatus "start" >> $scriptlog 2>&1
    8786
  • trunk/MagicSoft/Mars/datacenter/scripts/checktransfer

    r8232 r8482  
    2020#   Author(s): Daniela Dorner  09/2006 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
  • trunk/MagicSoft/Mars/datacenter/scripts/copyscript

    r8469 r8482  
    2020#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    9999
    100100#find all dates in transfer-directory
    101 dates=`find $transdir/*/ -type d | grep -o --regexp=20[0-9][0-9]_[0-1][0-9]_[0-3][0-9]` >> $scriptlog 2>&1
     101dates=`find $transdir/*/ -type d | grep -o --regexp=20[0-9][0-9]_[0-1][0-9]_[0-3][0-9] | sort | uniq` >> $scriptlog 2>&1
    102102if ! [ "$dates" = "" ]
    103103then
     
    220220do
    221221   printprocesslog "INFO process "$opticalfile
    222 #   echo $opticalfile
    223222   file=`basename $opticalfile`
    224223   year=`echo $file | cut -c 0-4`
     
    226225   makedir $opticallogpath >> $scriptlog 2>&1
    227226   opticallogfile=$opticallogpath/filloptical-$file.log
    228 #   echo "logfile: "$opticallogfile
    229227 
    230228   checkfilloptical=`root -q -b $macrospath/filloptical.C+\("\"$opticalfile\""\,kFALSE\) | tee $opticallogfile | intgrep`
    231 #   checkfilloptical=`root -q -b $macrospath/filloptical.C+\("\"$opticalfile\""\) | tee $opticallogfile | intgrep`
    232229           
    233230   case $checkfilloptical in
     
    266263
    267264#getting new catalogfiles
    268 catfiles=`find $subsystempath/cc/ -name $magfav -newer $catalog | sort`
     265for (( i=0 ; i < 31 ; i++ ))
     266do
     267   date=`date --date "-${i}day" +%Y/%m/%d`
     268   path=$subsystempath/cc/$date
     269   catfiles=$catfiles" "`find $path -name $magfav -newer $catalog`
     270done
    269271
    270272for catfile in ${catfiles[@]}
  • trunk/MagicSoft/Mars/datacenter/scripts/correcttime

    r7944 r8482  
    2020#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    3131# Then for each run the timing correction is done
    3232# If this was successful, the status is inserted into the database using
    33 # the macro setstatus.C
     33# the function setstatus.
    3434#
    3535# This script was needed for the data between 06/2004 and 02/2005 (including
     
    6969   printprocesslog "INFO run correct_raw_time for run $run"
    7070   no=`printf %08d $run | cut -c 1-5`
    71    var1=$no
    72    var2=$run
    7371   echo "getting path for run $run ... " >> $scriptlog 2>&1
    74    infile=`find $datapath/rawfiles-wrong-timing/ -name *${run}_[D,C,P,S]_*`
     72   infile=`find $datapath/rawfiles-wrong-timing/ -name *${run}_[DCPS]_*`
    7573   echo "infile:"$infile >> $scriptlog 2>&1
    7674   outfile=`echo $infile | sed -e 's/-wrong-timing//g'`
     
    8684   check1=0
    8785   echo "run $program..." >> $scriptlog 2>&1
     86   primvar=$run
    8887   setstatus "start" >> $scriptlog 2>&1
    8988
  • trunk/MagicSoft/Mars/datacenter/scripts/dodatacheck

    r7954 r8482  
    2020#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    3636#    taken into account when doexclusions is running the next time
    3737# If this was successful, the status is inserted into the database using
    38 # the macro setstatus.C
     38# the function setstatus.
    3939#
    4040
     
    6363no=`printf %08d $run | cut -c 0-2`
    6464no2=`printf %08d $run`
    65 var1=$date
    66 var2=$no2
    67 rawfile=`find /magic/data/rawfiles/ -name *${run}_[D,P,C,S]_*_E.raw -o -name *${run}_[D,P,C,S]_*_E.raw.gz`
     65query="SELECT DATE_FORMAT(ADDDATE(fRunStart, INTERVAL +13 HOUR), '%Y/%m/%d') FROM RunData where fRunNumber="$run
     66date=`sendquery`
     67rawfile=`find /magic/data/rawfiles/$date -name *${run}_[D,P,C,S]_*_E.raw -o -name *${run}_[DPCS]_*_E.raw.gz`
    6868echo "rawfile: "$rawfile >> $scriptlog 2>&1
    69 date=`echo $rawfile | cut -c 22-31`
    7069# for sinope the date is needed in the format YYYY-MM-DD
    7170date2=`echo $date | sed -e 's/\//-/g'`
    7271
     72primvar=$no2
    7373setstatus "start" >> $scriptlog 2>&1
    7474
     
    113113   
    114114   case $check2 in
    115        0)   echo " check2=$check2 -> everything ok -> go on with $program..." >> $scriptlog 2>&1
    116             ;;
    117        *)   echo " check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
    118             printprocesslog "ERROR sinope $sin failed for $rawfile"
    119             com=$Fsinope
    120 #            comadd=
    121             check=$check2
    122             setstatus "stop" >> $scriptlog 2>&1
    123             continue 2;;
     115      0)   echo " check2=$check2 -> everything ok -> go on with $program..." >> $scriptlog 2>&1
     116           ;;
     117      *)   echo " check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
     118           printprocesslog "ERROR sinope $sin failed for $rawfile"
     119           com=$Fsinope
     120#           comadd=
     121           check=$check2
     122           setstatus "stop" >> $scriptlog 2>&1
     123           continue 2;;
    124124   esac
    125125   check2=1
     
    182182starttime="NULL"
    183183failedtime="NULL"
    184 var1=$date
    185 var2=$no2
    186184setstatus "stop" >> $scriptlog 2>&1
    187185
  • trunk/MagicSoft/Mars/datacenter/scripts/doexclusions

    r7954 r8482  
    2020#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    3232# macro doexclusions.C
    3333# If this was successful, the status is inserted into the database using
    34 # the macro setstatus.C
     34# the function setstatus.
    3535#
    3636
     
    6969   printprocesslog "INFO do exclusions for $date"
    7070   year2=`echo $date | cut -c 1-4`
    71    var1=$year2
    72    var2=$date
    7371   doexclusionspath=$logpath/$program/$year2
    7472   makedir $doexclusionspath >> $scriptlog 2>&1
    7573   doexclusionslog=$doexclusionspath/doexclusions-$date.log
    7674
     75   primvar=$date
    7776   setstatus "start" >> $scriptlog 2>&1
    7877
  • trunk/MagicSoft/Mars/datacenter/scripts/doqualityplots

    r8465 r8482  
    2020#   Author(s): Daniela Dorner  08/2005 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    5454
    5555case $check0 in
    56     1)   echo " check0=$check0 -> everything ok -> move files" >> $scriptlog 2>&1
    57          printprocesslog "INFO plots successfully produced"
    58          ;;
    59     *)   echo " check0=$check0 -> ERROR -> couldn't create plots -> exit" >> $scriptlog 2>&1
    60          printprocesslog "ERROR producing plots failed"
    61          finish >> $scriptlog 2>&1
    62          ;;
     56   1)   echo " check0=$check0 -> everything ok -> move files" >> $scriptlog 2>&1
     57        printprocesslog "INFO plots successfully produced"
     58        ;;
     59   *)   echo " check0=$check0 -> ERROR -> couldn't create plots -> exit" >> $scriptlog 2>&1
     60        printprocesslog "ERROR producing plots failed"
     61        finish >> $scriptlog 2>&1
     62        ;;
    6363esac
    6464
  • trunk/MagicSoft/Mars/datacenter/scripts/dowebplots

    r8465 r8482  
    2020#   Author(s): Daniela Dorner  08/2005 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    4444do
    4545   case $opts in
    46      p)  type=$OPTARG
    47          echo "got programname: $type"  >> $scriptlog 2>&1
    48          ;;
    49      ?)  echo "usage: $(basename $0) -p programname"  >> $scriptlog 2>&1
    50          ;;
     46      p)  type=$OPTARG
     47          echo "got programname: $type"  >> $scriptlog 2>&1
     48          ;;
     49      ?)  echo "usage: $(basename $0) -p programname"  >> $scriptlog 2>&1
     50          ;;
    5151   esac
    5252done
  • trunk/MagicSoft/Mars/datacenter/scripts/filesondisk

    r8410 r8482  
    2020#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    3333#   this includes also the search for missing cacofiles:
    3434#   Sometimes the DAQ aborts a run and starts itself a new one. In this
    35 #   cases the camera controll doesn't start a new file, as the command to
     35#   cases the camera control doesn't start a new file, as the command to
    3636#   start a new run was not sent by the central control. So the caco
    3737#   information is stored in the previous caco file, which has a
     
    4040#   information has to be found.
    4141#   In this script the search and inserting into the database is done
    42 #   using the macros findcacofiles.C and insertcacofile.C
     42#   using the macro findcacofiles.C
    4343# - rawfiles
    4444# The update in the database is done using the macro resetallruns.C
     
    6666printprocesslog "INFO checking ccfiles"
    6767filename=$filesondisklogpath/ccfilesondisk-$datetime.txt
     68if ls $filename >/dev/null 2>&1
     69then
     70   rm -v $filename >> $scriptlog 2>&1
     71fi
    6872column=fCCFileAvail
    6973find $subsystempath/cc/ -name '*_S.rep' | cut -d_ -f2  > $filename
     
    8589
    8690
     91
    8792echo "checking disk for cacofiles..."  >> $scriptlog 2>&1
    8893printprocesslog "INFO checking cacofiles"
    8994filename=$filesondisklogpath/cacofilesondisk-$datetime.txt
     95if ls $filename >/dev/null 2>&1
     96then
     97   rm -v $filename >> $scriptlog 2>&1
     98fi
    9099column=fCaCoFileAvail
    91100find $subsystempath/caco/ -name '*.txt' | cut -d_ -f8 | grep [0-9] > $filename
     
    107116
    108117date=`date +%F`
    109 echo "checking missing cacofiles..." >> $scriptlog 2>&1
     118echo "finding missing cacofiles..." >> $scriptlog 2>&1
    110119printprocesslog "INFO checking missing cacofiles"
    111 check1=`root -q -b $macrospath/findcacofiles.C+\("\"$date\""\,"\"$filesondisklogpath\""\) | tee $filesondisklogpath/findcacofiles-$datetime.log | intgrep`
     120check1=`root -q -b $macrospath/findcacofiles.C+ | tee $filesondisklogpath/findcacofiles-$datetime.log | intgrep`
    112121
    113122case $check1 in
     
    123132esac
    124133
    125 printprocesslog "INFO finding missing cacofiles"
    126 missingcacoruns=(`cat $filesondisklogpath/findcacofiles-$date.txt`)
    127 for missingcacorun in ${missingcacoruns[@]}
    128 do
    129    runno=$missingcacorun
    130    echo "missing cacofile for run "$runno >> $scriptlog 2>&1
    131    echo "-> finding cacofile" >> $scriptlog 2>&1
    132    ccfile=`find $subsystempath/cc/ -name [2][0][0-2][0-9][0,1][0-9][0-3][0-9]_*${runno}_[P,D,C,S]_*_S.rep -and ! -name [2][0][0-2][0-9][0,1][0-9][0-3][0-9]_*[1-9]${runno}_[P,D,C,S]_*_S.rep` 2>/dev/null
    133    echo " ccfile: "$ccfile  >> $scriptlog 2>&1
    134    if [ "$ccfile" = "" ]
    135    then
    136       echo " no ccfile found for run "$runno >> $scriptlog 2>&1
    137       continue
    138    fi
    139    for (( i = 0; i <= 10; i++ ))
    140    do
    141       newrun=`echo $runno - $i | bc`
    142       path=`dirname $ccfile`
    143       path=`echo $path | sed -e 's/cc/caco/'`
    144       cacofile=`find $path -name *$newrun* 2>/dev/null`
    145       if [ "$cacofile" = "" ]
    146       then
    147          continue
    148       else
    149          printprocesslog "INFO inserting cacofile for run $missingcacorun"
    150          echo " inserting cacofile $file for run $missingcacorun..." >> $scriptlog 2>&1
    151          check2=`root -q -b $macrospath/insertcacofile.C+\("\"$runno\""\,"\"$newrun\""\) | tee $filesondisklogpath/insertcacofile-$missingcacorun.log | intgrep`
    152 
    153          case $check2 in
    154             1)   echo " check2=$check2 -> everything ok -> insert is done" >> $scriptlog 2>&1
    155                  printprocesslog "INFO inserted $missingcacorun successfully"
    156                  ;;
    157             0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1
    158                  printprocesslog "WARN connection to DB failed"
    159                  ;;
    160             *)   echo " check2=$check2 -> ERROR -> something went wrong while inserting run "$missingcacorun >> $scriptlog 2>&1
    161                  printprocesslog "ERROR insertcacofile.C failed for run $missingcacorun"
    162                  ;;
    163          esac
    164          break
    165       fi
    166    done
    167    if [ "$cacofile" = "" ]
    168    then
    169       echo " no cacofile found for run "$runno >> $scriptlog 2>&1
    170       printprocesslog "WARN no cacofile found for run $runno"
    171    else
    172       echo " cacofile: "$cacofile >> $scriptlog 2>&1
    173    fi
    174 done
    175134
    176135
     
    178137printprocesslog "INFO checking rawfiles"
    179138filename=$filesondisklogpath/rawfilesondisk-$datetime.txt
     139if ls $filename >/dev/null 2>&1
     140then
     141   rm -v $filename >> $scriptlog 2>&1
     142fi
    180143column=fRawFileAvail
    181144find $datapath/rawfiles -name '*.raw' -o -name '*.gz' | cut -d_ -f2 > $filename
  • trunk/MagicSoft/Mars/datacenter/scripts/fillcallisto

    r7954 r8482  
    2020#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    3333# fillcalib.C and fillsignal.C
    3434# If this was successful, the status is inserted into the database using
    35 # the macro setstatus.C
     35# the function setstatus.
    3636#
    3737
     
    7070   no=`printf %08d $sequence | cut -c 0-4`
    7171   no2=`printf %08d $sequence`
    72    var1=$no
    73    var2=$no2
    7472   path="$datapath/callisto/$no/$no2"
    7573   signalfile=$path/signal$no2.root
     
    8179
    8280   echo "run $program for sequence $sequence" >> $scriptlog 2>&1
     81   primvar=$no2
    8382   setstatus "start" >> $scriptlog 2>&1
    8483   echo "run fillcalib..." >> $scriptlog 2>&1
  • trunk/MagicSoft/Mars/datacenter/scripts/fillganymed

    r7954 r8482  
    2020#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    3232# into the table Ganymed in the database using the macro fillganymed.C
    3333# If this was successful, the status is inserted into the database using
    34 # the macro setstatus.C
     34# the function setstatus.
    3535#
    3636
     
    7070   no=`printf %08d $dataset | cut -c 0-5`
    7171   no2=`printf %08d $dataset`
    72    var1=$no
    73    var2=$no2
    7472   path="$datapath/ganymed/$no/$no2"
    7573   ganymedfile=$path/ganymed$no2.root
     
    7977
    8078   echo "run $program for dataset $dataset" >> $scriptlog 2>&1
     79   primvar=$no2
    8180   setstatus "start" >> $scriptlog 2>&1
    8281
  • trunk/MagicSoft/Mars/datacenter/scripts/fillstar

    r7954 r8482  
    2020#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    3232# into the table Star in the database using the macro fillstar.C
    3333# If this was successful, the status is inserted into the database using
    34 # the macro setstatus.C
     34# the function setstatus.
    3535#
    3636
     
    7070   no=`printf %08d $sequence | cut -c 0-4`
    7171   no2=`printf %08d $sequence`
    72    var1=$no
    73    var2=$no2
    7472   path="$datapath/star/$no/$no2"
    7573   starfile=$path/star$no2.root
     
    7977
    8078   echo "run $program for sequence $sequence" >> $scriptlog 2>&1
     79   primvar=$no2
    8180   setstatus "start" >> $scriptlog 2>&1
    8281
  • trunk/MagicSoft/Mars/datacenter/scripts/findnewstars

    r8380 r8482  
    2020#   Author(s): Daniela Dorner  10/2006 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
  • trunk/MagicSoft/Mars/datacenter/scripts/findnotseqruns

    r8380 r8482  
    2020#   Author(s): Daniela Dorner  10/2006 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
  • trunk/MagicSoft/Mars/datacenter/scripts/insertdatasets

    r7961 r8482  
    2020#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
  • trunk/MagicSoft/Mars/datacenter/scripts/insertsequences

    r7954 r8482  
    2020#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
  • trunk/MagicSoft/Mars/datacenter/scripts/jobmanager

    r8461 r8482  
    2020#   Author(s): Daniela Dorner  05/2006 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    142142         echo "condor is not working -> sleeping $errorsleeptime" >> $jmscriptlog 2>&1
    143143         printprocesslog "WARN submitting ${scripts[$i]} to condor failed"
     144         if [ $errorsleeptime -lt $sleeptimelimit ]
     145         then
     146            errorsleeptime=`echo " $errorsleeptime + $errorsleeptimedefault " | bc`
     147         fi
    144148         sleep $errorsleeptime
     149      else
     150         errorsleeptime=$errorsleeptimedefault
    145151      fi
    146152      date >> $jmscriptlog 2>&1
  • trunk/MagicSoft/Mars/datacenter/scripts/linkmc

    r8433 r8482  
    2020#   Author(s): Daniela Dorner  12/2005 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    149149   for (( i=1 ; i <= 12 ; i++ ))
    150150   do
    151        if [ "${modes[$i]}" == "$testmode" ]
    152        then
    153           totalmode=$i
    154           break
    155        fi
     151      if [ "${modes[$i]}" == "$testmode" ]
     152      then
     153         totalmode=$i
     154         break
     155      fi
    156156   done
    157157
  • trunk/MagicSoft/Mars/datacenter/scripts/makecallistolinks

    r8410 r8482  
    2020#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
  • trunk/MagicSoft/Mars/datacenter/scripts/mcsequences

    r8437 r8482  
    2020#   Author(s): Daniela Dorner  12/2005 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
  • trunk/MagicSoft/Mars/datacenter/scripts/movingsubsystemfiles

    r7460 r8482  
    2020#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    4545for subsysfile in ${subsysfiles[@]}
    4646do
    47   newsubsysfile=`echo $subsysfile | sed -e 's/datacenter\/fromtape/subsystemdata/g' -e 's/daqlog/daq__/g' -e 's/ccdata/cc/g' -e 's/cacodata/caco/g' -e 's/_/\//1' -e 's/_/\//1' -e 's/\/\///g'`
    48   newdir=`dirname $newsubsysfile`
    49   if [ ! -d $newdir ]
    50   then
    51     echo "make dir "$newdir
    52     mkdir -p $newdir
    53   fi
     47   newsubsysfile=`echo $subsysfile | sed -e 's/datacenter\/fromtape/subsystemdata/g' -e 's/daqlog/daq__/g' -e 's/ccdata/cc/g' -e 's/cacodata/caco/g' -e 's/_/\//1' -e 's/_/\//1' -e 's/\/\///g'`
     48   newdir=`dirname $newsubsysfile`
     49   if [ ! -d $newdir ]
     50   then
     51      echo "make dir "$newdir
     52      mkdir -p $newdir
     53   fi
    5454
    55   mv -v $subsysfile $newsubsysfile
     55   mv -v $subsysfile $newsubsysfile
    5656done
    5757
  • trunk/MagicSoft/Mars/datacenter/scripts/processmcsequences

    r8080 r8482  
    2020#   Author(s): Daniela Dorner  12/2005 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
  • trunk/MagicSoft/Mars/datacenter/scripts/rmlocks

    r8007 r8482  
    2020#   Author(s): Daniela Dorner  08/2005 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
  • trunk/MagicSoft/Mars/datacenter/scripts/runcallisto

    r8454 r8482  
    2020#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    5151sequence=$process
    5252
    53 # lock sequ
     53# lock sequ for cal
    5454lockfile=$lockpath/lock-$table-$column-$sequence.txt
    5555checklock >> $scriptlog 2>&1
     
    6262no=`printf %08d $sequence | cut -c 0-4`
    6363no2=`printf %08d $sequence`
    64 var1=$no
    65 var2=$no2
    6664outpath="$datapath/$program/$no/$no2"
    6765makedir $outpath >> $scriptlog 2>&1
     
    8078   if [ $sequence -gt 200000 ]
    8179   then
    82         ln -vs $callistorcmux $outpath/callisto.rc >> $scriptlog 2>&1
     80      ln -vs $callistorcmux $outpath/callisto.rc >> $scriptlog 2>&1
    8381   else
    84         ln -vs $callistorcnew $outpath/callisto.rc >> $scriptlog 2>&1
     82      ln -vs $callistorcnew $outpath/callisto.rc >> $scriptlog 2>&1
    8583   fi
    8684   callistorcseq=$outpath/callisto.rc
    8785fi
    8886
     87# lock sequ for zipping
     88lockfile=$lockpath/calzip$sequence.txt
     89# if lockfile is already existing, 1 is returned
     90if ! checklock return 1 >> $scriptlog 2>&1
     91then
     92   # reset lockfile name
     93   lockfile=$lockpath/lock-$table-$column-$sequence.txt
     94   finish >> $scriptlog 2>&1
     95fi
     96
     97primvar=$no2
    8998setstatus "start" >> $scriptlog 2>&1
    9099
     
    92101./callisto -b -q -v4 -f --log=$outpath/$program$no2.log --html=$outpath/$program$no2.html --out=$outpath --config=$callistorcseq $sequfile  2>> $scriptlog > /dev/null
    93102check1=$?
     103
     104# remove lockfile for zip and reset lockfile name
     105rm -v $lockfile >> $scriptlog 2>&1
     106lockfile=$lockpath/lock-$table-$column-$sequence.txt
    94107
    95108case $check1 in
     
    117130           # find cc and caco file
    118131           # if file is missing continue with next sequence
     132           date=`date --date \`basename $calfile | cut -d_ -f1 +%Y/%m/%d\``
     133           ccpath=$subsystempath/cc/$date
     134           cacopath=$subsystempath/caco/$date
    119135           runno=`echo $calfile | cut -d_ -f2 | sed -e 's/^0//' | sed -e 's/^0//' | sed -e 's/^0//' `
    120            ccfile=`find /magic/subsystemdata/cc/ -name [2][0][0-2][0-9][0,1][0-9][0-3][0-9]_*${runno}_[P,D,C,S]_*_S.rep -and ! -name [2][0][0-2][0-9][0,1][0-9][0-3][0-9]_*[1-9]${runno}_[P,D,C,S]_*_S.rep`
     136           ccfile=`find $ccpath -name 20[0-2][0-9][01][0-9][0-3][0-9]_*${runno}_[PDCS]_*_S.rep`
    121137           source=`echo $ccfile | cut -d_ -f4`
    122            cacofile=`find /magic/subsystemdata/caco/ -name dc_[2][0][0-2][0-9]_[0,1][0-9]_[0-3][0-9]_*${runno}_${source}.txt -and ! -name dc_[2][0][0-2][0-9]_[0,1][0-9]_[0-3][0-9]_*[1-9]${runno}_${source}.txt`
    123 #            cacofile=`find /magic/subsystemdata/caco/ -name dc_[2][0][0-2][0-9]_[0,1][0-9]_[0-3][0-9]_*${runno}_*.txt`
     138           cacofile=`find /magic/subsystemdata/caco/$date -name dc_20[0-2][0-9]_[01][0-9]_[0-3][0-9]_*${runno}_${source}.txt`
    124139           if [ "$ccfile" = "" ]
    125140           then
     
    138153              do
    139154                 newrun=`echo $runno - $i | bc`
    140                  path=`dirname $ccfile`
    141                  path=`echo $path | sed -e 's/cc/caco/'`
    142                  echo "path: "$path >> $scriptlog 2>&1
    143                  cacofile=`find $path -name *$newrun*`
     155                 cacofile=`find $cacopath -name *$newrun*`
    144156                 if [ "$cacofile" = "" ]
    145157                 then
    146158                    if [ $i -eq 9 ]
    147159                    then
    148                        echo "no cacofile found" >> $scriptlog 2>&1
     160                       echo "no cacofile found for runno $newrun in $cacopath" >> $scriptlog 2>&1
    149161                       printprocesslog "ERROR cacofile $cacofile not found for $calfile"
    150162                       com=$Fnocacofile
     
    164176           check2=$?
    165177           case $check2 in
    166                    0)   echo " check2=$check2 -> everything ok, merppccupdate worked -> continue" >> $scriptlog 2>&1
    167                         printprocesslog "INFO merppupdated $calfile sucessfully with $ccfile"
    168                         ;;
    169                    *)   echo " check2=$check2 -> ERROR -> merppccupdate failed" >> $scriptlog 2>&1
    170                         printprocesslog "ERROR merppccupdate with file $ccfile failed for $calfile"
    171                         com=$Fmerppcc
    172                         comadd=$runno
    173                         check=$check2
    174                         break ;;
     178              0)   echo " check2=$check2 -> everything ok, merppccupdate worked -> continue" >> $scriptlog 2>&1
     179                   printprocesslog "INFO merppupdated $calfile sucessfully with $ccfile"
     180                   ;;
     181              *)   echo " check2=$check2 -> ERROR -> merppccupdate failed" >> $scriptlog 2>&1
     182                   printprocesslog "ERROR merppccupdate with file $ccfile failed for $calfile"
     183                   com=$Fmerppcc
     184                   comadd=$runno
     185                   check=$check2
     186                   break ;;
    175187           esac
    176188           echo "./merpp -u --log=$merpplogpath/merppcacoupdate$runno.log --html=$merpplogpath/merppcacoupdate$runno.html --auto-time $cacofile $calfile 2>> $scriptlog> /dev/null" >> $scriptlog 2>&1
     
    178190           check3=$?
    179191           case $check3 in
    180                    0)   echo " check3=$check3 -> everything ok, merppcacoupdate worked -> continue" >> $scriptlog 2>&1
    181                         printprocesslog "INFO merppupdated $calfile sucessfully with $cacofile"
    182                         ;;
    183                    *)   echo " check3=$check3 -> ERROR -> merppcacoupdate failed" >> $scriptlog 2>&1
    184                         printprocesslog "ERROR merppcacoupdate with file $cacofile failed for $calfile"
    185                         com=$Fmerppcaco
    186                         comadd=$runno
    187                         check=$check3
    188                         break ;;
     192              0)   echo " check3=$check3 -> everything ok, merppcacoupdate worked -> continue" >> $scriptlog 2>&1
     193                   printprocesslog "INFO merppupdated $calfile sucessfully with $cacofile"
     194                   ;;
     195              *)   echo " check3=$check3 -> ERROR -> merppcacoupdate failed" >> $scriptlog 2>&1
     196                   printprocesslog "ERROR merppcacoupdate with file $cacofile failed for $calfile"
     197                   com=$Fmerppcaco
     198                   comadd=$runno
     199                   check=$check3
     200                   break ;;
    189201           esac
    190202        done
  • trunk/MagicSoft/Mars/datacenter/scripts/runganymed

    r8433 r8482  
    2020#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    6161no=`printf %08d $dataset | cut -c 0-5`
    6262no2=`printf %08d $dataset`
    63 var1=$no
    64 var2=$no2
    6563outpath="$datapath/$program/$no/$no2"
    6664makedir $outpath >> $scriptlog 2>&1
     
    7573fi
    7674
     75primvar=$no2
    7776setstatus "start" >> $scriptlog 2>&1
    7877
  • trunk/MagicSoft/Mars/datacenter/scripts/runstar

    r8176 r8482  
    2020#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    6161no=`printf %08d $sequence | cut -c 0-4`
    6262no2=`printf %08d $sequence`
    63 var1=$no
    64 var2=$no2
    6563outpath="$datapath/$program/$no/$no2"
    6664inpath=`echo $outpath | sed -e 's/star/callisto/'`
     
    6967sequfile="$sequpath/$no/sequence$no2.txt"
    7068
     69primvar=$no2
    7170setstatus "start" >> $scriptlog 2>&1
    7271
  • trunk/MagicSoft/Mars/datacenter/scripts/scriptlauncher

    r8462 r8482  
    2020#   Author(s): Daniela Dorner  08/2006 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    3737scriptlog=$runlogpath/scriptlauncher`date +%F`.log
    3838
    39 echo `date`": starting $0 $@"  >> $scriptlog 2>&1
     39echo `date`": starting $0 $@" >> $scriptlog 2>&1
    4040
    4141path=`dirname $0`
    4242date=`date +%Y-%m-%d`
    4343
    44 for i in $@
     44scripts=( `echo $@ | sed -e 's/allatthesametime//'` )
     45num=${#scripts[@]}
     46echo "$num scripts have to be launched" >> $scriptlog 2>&1
     47i=0
     48
     49while [ $i -lt $num ]
    4550do
    46    if [ "$i" = "allatthesametime" ]
    47    then
    48       continue
    49    fi
    50    echo " launching $i..." >> $scriptlog 2>&1
    51    pid=`/usr/local/bin/condor_submit -a path=$path -a prog=$i -a date=$date -a dir=$runlogpath $path/run.condor 2>> $errorlog | grep 'submitted to cluster' | cut -dr -f2`
     51   echo " launching ${scripts[$i]}..." >> $scriptlog 2>&1
     52   pid=`/usr/local/bin/condor_submit -a path=$path -a prog=${scripts[$i]} -a date=$date -a dir=$runlogpath $path/run.condor 2>> $errorlog | grep 'submitted to cluster' | cut -dr -f2`
    5253   if [ "$pid" = "" ]
    5354   then
    5455      echo `date`" WARN condor is not working " >> $errorlog 2>&1
    55       printprocesslog "WARN submitting $i to condor failed"
     56      printprocesslog "WARN submitting ${scripts[$i]} to condor failed"
     57      continue
    5658   fi
    5759   if ! echo $@ | grep "allatthesametime" >/dev/null 2>$errorlog
    5860   then
    59       echo "  waiting for $i to be done..." >> $scriptlog 2>&1
     61      echo "  waiting for ${scripts[$i]} to be done..." >> $scriptlog 2>&1
    6062      /usr/local/bin/condor_wait $runlogpath/condor-$date.log $pid >/dev/null 2>$errorlog
    6163   fi
     64   i=`expr $i + 1`
    6265done
    6366echo `date`": all done/submitted." >> $scriptlog 2>&1
  • trunk/MagicSoft/Mars/datacenter/scripts/setup

    r8167 r8482  
    2020#   Author(s): Daniela Dorner  05/2005 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    6363sleeptime=30 #30
    6464sleeptimelimit=360 #360
    65 errorsleeptime=60 #60
     65errorsleeptimedefault=60 #60
    6666max=18 #maximum number of processes
    6767
  • trunk/MagicSoft/Mars/datacenter/scripts/sourcefile

    r8400 r8482  
    2020#   Author(s): Daniela Dorner  05/2005 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    4747   if [ ! -d $@ ]
    4848   then
    49      mkdir -pv $@
    50      if [ ! -d $@ ]
    51      then
    52         echo "could not make dir "$@
    53         rm -v $todofile
    54         rm -v $lockfile
    55         date
    56         exit
    57      fi
     49      mkdir -pv $@
     50      if [ ! -d $@ ]
     51      then
     52         echo "could not make dir "$@
     53         rm -v $todofile
     54         rm -v $lockfile
     55         date
     56         exit
     57      fi
    5858   fi
    5959}
     
    133133function finish()
    134134{
    135    if ls $todofile >/dev/null 2>&1
     135   if ! [ "$todofile" = "" ] && ls $todofile >/dev/null 2>&1
    136136   then
    137137      rm -v $todofile
     
    160160   checklock0=$?
    161161   case $checklock0 in
    162        0)   echo " checklock0=$checklock0 -> continue " ;;
    163        1)   echo " checklock0=$checklock0 -> file $lockfile exists -> exit"
    164             date
    165             exit;;
    166        *)   echo " checklock0=$checklock0 -> something went completely wrong" ;;
     162      0)   echo " checklock0=$checklock0 -> continue " ;;
     163      1)   echo " checklock0=$checklock0 -> file $lockfile exists"
     164           date
     165           $@
     166           exit;;
     167      *)   echo " checklock0=$checklock0 -> something went completely wrong" ;;
    167168   esac
    168 }
    169 
    170 # function calling the macro, which is producing the todo-list
    171 function getdolistroot()
    172 {
    173    datetime=`date +%F-%H-%M-%S`
    174    year=`date +%Y`
    175    date=NULL
    176 
    177    getstatuslogpath=$logpath/getstatus/$program/$year
    178    getstatuslog=$getstatuslogpath/getstatus-$table-$column-$datetime.log
    179    makedir $getstatuslogpath
    180 
    181    # get todo list
    182    echo "getting todo list..."
    183    check0=`root -q -b $macrospath/getdolist.C+\("\"$table\""\,"\"$column\""\,"\"$date\""\,"\"$listpath\""\) | tee $getstatuslog | grep int | sed -e 's/(int)//'`
    184 
    185    case $check0 in
    186       1)   echo " check0=$check0 -> everything ok, got todo list -> run $program";;
    187       *)   echo " check0=$check0 -> ERROR -> could not get todo list -> exit"
    188            finish ;;
    189    esac
    190 
    191169}
    192170
     
    222200               ;;
    223201       stop)   case $check in
    224                  ok)  echo "setstatus stop - ok"
    225                       statustime="Now()"
    226                       ;;
    227                  no)  echo "setstatus stop - nothing new"
    228                       check="ok"
    229                       ;;
    230                   *)  echo "setstatus stop - failed"
    231                       starttime=noreset
    232                       if [ "$check" == "" ]
    233                       then
    234                          returncode=1
    235                       else
    236                          returncode=$check
    237                       fi
    238                       failedcode=$com
    239                       if ! [ "$comadd" = "" ]
    240                       then
    241                          failedcodeadd=$comadd
    242                       fi
    243                       failedtime="Now()"
    244                       check="ok"
    245                       ;;
     202                  ok)  echo "setstatus stop - ok"
     203                       statustime="Now()"
     204                       ;;
     205                  no)  echo "setstatus stop - nothing new"
     206                       check="ok"
     207                       ;;
     208                   *)  echo "setstatus stop - failed"
     209                       starttime=noreset
     210                       if [ "$check" == "" ]
     211                       then
     212                          returncode=1
     213                       else
     214                          returncode=$check
     215                       fi
     216                       failedcode=$com
     217                       if ! [ "$comadd" = "" ]
     218                       then
     219                          failedcodeadd=$comadd
     220                       fi
     221                       failedtime="Now()"
     222                       check="ok"
     223                       ;;
    246224               esac
    247225               ;;
     
    250228               finish
    251229               ;;
    252    esac
    253 }
    254 
    255 # function calling the macro to set the status, after a process has finished
    256 function setstatusroot()
    257 {
    258    # set status values
    259    resetstatusvalues
    260    evalstatus $@
    261 
    262 #   printstatusvalues
    263    # set status
    264    setstatuslogpath=$logpath/setstatus/$program/$var1
    265    makedir $setstatuslogpath
    266    setstatuslog=$setstatuslogpath/setstatus-$@-$program-$var2.log
    267    checkstatus=`root -q -b $macrospath/setstatus.C+\("\"$var2\""\,"\"$table\""\,"\"$column\""\,"\"$statustime\""\,"\"$returncode\""\,"\"$failedcode\""\,"\"$failedcodeadd\""\,"\"$starttime\""\,"\"$failedtime\""\) | tee $setstatuslog | grep int | sed -e 's/(int)//'`
    268    case $checkstatus in
    269       1)   echo " checkstatus=$checkstatus -> everything ok, status has been set";;
    270       *)   echo " checkstatus=$checkstatus -> ERROR -> step could not be set -> exit"
    271            finish ;;
    272230   esac
    273231}
     
    417375   if [ "$reset" = "no" ]
    418376   then
    419       echo "YOU CAN'T RESET $column for $var2!!!"
    420       printprocesslog "ERROR you can't reset $column for $var2"
     377      echo "YOU CAN'T RESET $column for $primvar!!!"
     378      printprocesslog "ERROR you can't reset $column for $primvar"
    421379      finish
    422380   fi
     
    434392   fi
    435393   query=$query", fFailedTime=$failedtime, fFailedCode=$failedcode, fFailedCodeAdd=$failedcodeadd, fReturnCode=$returncode "
    436    query=$query" where $primary='$var2'"
     394   query=$query" where $primary='$primvar'"
    437395   echo " QUERY: "$query
    438396   if ! mysql -s -u $us --password=$pw --host=vela $db -e " $query "
     
    445403}
    446404
     405# function to send a mysql query
     406function sendquery()
     407{
     408   getdbsetup
     409   if ! val=`mysql -s -u $us --password=$pw --host=vela $db -e " $query "`
     410   then
     411      printprocesslog "ERROR could not query db (program: $program, function sendquery)"
     412      return 1
     413   fi
     414   if [ "$val" = "NULL" ]
     415   then
     416      val=
     417   fi
     418   echo $val
     419   return 0
     420}
     421
  • trunk/MagicSoft/Mars/datacenter/scripts/webupdate-callisto

    r7944 r8482  
    2020#   Author(s): Daniela Dorner  08/2006 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
  • trunk/MagicSoft/Mars/datacenter/scripts/webupdate-ganymed

    r7944 r8482  
    1818#
    1919#
    20 #   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
     20#   Author(s): Daniela Dorner  08/2006 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2004
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
  • trunk/MagicSoft/Mars/datacenter/scripts/webupdate-sinope

    r7944 r8482  
    1818#
    1919#
    20 #   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
     20#   Author(s): Daniela Dorner  08/2006 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2004
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
  • trunk/MagicSoft/Mars/datacenter/scripts/webupdate-star

    r7944 r8482  
    1818#
    1919#
    20 #   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
     20#   Author(s): Daniela Dorner  08/2006 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2004
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
  • trunk/MagicSoft/Mars/datacenter/scripts/writedatasetfiles

    r8193 r8482  
    2020#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    3333# the macro checkstardone.C
    3434# If this was successful, the status is inserted into the database using
    35 # the macro setstatus.C
     35# the function setstatus.
    3636#
    3737
     
    6868   no=`printf %08d $dataset | cut -c 0-5`
    6969   no2=`printf %08d $dataset`
    70    var1=$no
    71    var2=$dataset
    7270   datasetpathcpl=$datasetpath/$no
    7371   makedir $datasetpathcpl >> $scriptlog 2>&1
     
    7573   makedir $writedatasetfilelogpath >> $scriptlog 2>&1
    7674   logfile=$writedatasetfilelogpath/$program-$no2.log
     75
     76   primvar=$dataset
     77   setstatus "start" >> $scriptlog 2>&1
    7778   
    7879   check1=`root -q -b $macrospath/writedatasetfile.C+\($dataset\,\""$datasetpathcpl\""\) | tee $logfile | intgrep`
  • trunk/MagicSoft/Mars/datacenter/scripts/writesequencefiles

    r7954 r8482  
    2020#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    3232# the macro writesequencefile.C
    3333# If this was successful, the status is inserted into the database using
    34 # the macro setstatus.C
     34# the function setstatus.
    3535#
    3636
     
    7070   no=`printf %08d $sequence | cut -c 0-4`
    7171   no2=`printf %08d $sequence`
    72    var1=$no
    73    var2=$no2
    7472   sequencepath=$sequpath/$no
    7573   makedir $sequencepath >> $scriptlog 2>&1
     
    8078
    8179   echo "write sequencefile for sequence $sequence" >> $scriptlog 2>&1
     80   primvar=$no2
    8281   setstatus "start" >> $scriptlog 2>&1
    8382
  • trunk/MagicSoft/Mars/datacenter/scripts/zipscript

    r8331 r8482  
    2020#   Author(s): Daniela Dorner  09/2006 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    3030source `dirname $0`/sourcefile
    3131printprocesslog "INFO starting $0"
    32 program=zipscript
     32# to give the possibility to run several zipscripts at the same time,
     33# $1 is added
     34program=zipscript$1
    3335
    3436set -C
     
    5254
    5355for file in ${files[@]}
    54 do
     56do
     57   echo "processing file $file..." >> $scriptlog 2>&1
     58   runno=`basename $file | cut -d_ -f2`
     59   query="SELECT fSequenceFirst FROM RunData WHERE fRunNumber="$runno
     60   echo " sending query: $query" >> $scriptlog 2>&1
     61   if ! seq=`sendquery`
     62   then
     63      echo "querying seq for run $runno from the db did not work -> continue" >> $scriptlog 2>&1
     64      printprocesslog "WARN query $seq for run $runno from the db did not work"
     65      continue
     66   fi
     67   if [ "$seq" == "" ]
     68   then
     69      echo "no seq found for run $runno -> locking only run..." >> $scriptlog 2>&1
     70      seq=$runno
     71   fi
     72   echo "locking sequence $seq..."  >> $scriptlog 2>&1
     73   lockfile=$lockpath/calzip$seq.txt
     74   checklock continue >> $scriptlog 2>&1
     75   query="UPDATE SequenceProcessStatus set fNotZipping=NULL WHERE fSequenceFirst=$seq"
     76   echo " sending query: $query" >> $scriptlog 2>&1
     77   if ! sendquery
     78   then
     79      echo "locking $seq for callisto in db did not work ..." >> $scriptlog 2>&1
     80      printprocesslog "WARN locking $seq for callisto in db did not work"
     81      rm -v $lockfile >> $scriptlog 2>&1
     82      continue
     83   fi
    5584   echo "zipping $file ..." >> $scriptlog 2>&1
    56 #   if ssh pegasus nice -n 19 gzip -1f $file >> $scriptlog 2>&1
    57    if ssh phoenix nice -n 19 gzip -1f $file >> $scriptlog 2>&1
    58 
     85   if ssh -x phoenix nice -n 19 gzip -1f $file >> $scriptlog 2>&1
    5986   then
    60       chmod a-w $file >> $scriptlog 2>&1
     87      gzfile=$file".gz"
     88      chmod a-w $gzfile >> $scriptlog 2>&1
     89   else
     90      printprocesslog "WARN zipping $file did not work"
    6191   fi
     92   echo "unlocking sequence $seq..."  >> $scriptlog 2>&1
     93   query="UPDATE SequenceProcessStatus set fNotZipping=Now() WHERE fSequenceFirst=$seq"
     94   echo " sending query: $query" >> $scriptlog 2>&1
     95   if ! sendquery
     96   then
     97      echo "unlocking $seq for callisto in db did not work ..." >> $scriptlog 2>&1
     98      printprocesslog "ERROR unlocking $seq for callisto in db did not work"
     99      rm -v $lockfile >> $scriptlog 2>&1
     100      continue
     101   fi
     102   rm -v $lockfile >> $scriptlog 2>&1
    62103done
    63104
     105lockfile=$lockpath/lock-$program.txt
    64106finish >> $scriptlog 2>&1
    65107
    66 
    67 
    68 # old code for running script locally
    69 
    70 #rawdatapath=$datapath/rawfiles
    71 ##h:     0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
    72 #pnos=( 2 2 2 2 2 2 2 2 2 2  2  2  2  2  2  2  2  2  2  2  2  2  2  2 )
    73 #sl1=30 #sleeping time before new directory
    74 #sl2=60 #sleeping time before new process check
    75 #
    76 #dirs=`find $rawdatapath -type d | grep -v timecorrlogs | sort`
    77 ##dirs=`find $rawdatapath -type d | grep -v timecorrlogs | sort -r`
    78 #
    79 #for dir in ${dirs[@]}
    80 #do
    81 #   cont=`echo $dir | cut -d/ -f7`
    82 #   if [ "$cont" == "" ]
    83 #   then
    84 #      continue
    85 #   fi
    86 #
    87 #   if ! ls $dir/*.raw >/dev/null 2>&1
    88 #   then
    89 #      echo "no unzipped rawfiles in $dir left"
    90 #      continue
    91 #   fi
    92 #
    93 #   echo "sleeping $sl1..."
    94 #   sleep $sl1
    95 #
    96 #   h=`date +%k`
    97 #   count=`ps aux | grep gzip | grep -v grep | wc -l`
    98 #   echo "count: $count - h: $h - pno: ${pnos[$h]}"
    99 #   while [ "$count" -ge "${pnos[$h]}" ]
    100 #   do
    101 #      echo "sleeping $sl2..."
    102 #      sleep $sl2
    103 #      h=`date +%k`
    104 #      count=`ps aux | grep gzip | grep -v grep | wc -l`
    105 #      echo "count: $count - h: $h - pno: ${pnos[$h]}"
    106 #   done
    107 #   echo $dir
    108 #   du -hs $dir
    109 #   echo "gzip -1f $dir/*.raw &"
    110 #   gzip -1f $dir/*.raw &
    111 #done
    112 #
    113 
    114 
    115 # old code for running script with condor
    116 
    117 #rawdatapath=$datapath/rawfiles
    118 ##h:     0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
    119 #pnos=( 2 2 2 2 2 2 2 2 2 2  2  2  2  2  2  2  2  2  2  2  2  2  2  2 )
    120 #sl1=30 #sleeping time before new directory
    121 #sl2=60 #sleeping time before new process check
    122 #
    123 #dirs=`find $rawdatapath -type d | grep -v timecorrlogs | sort`
    124 ##dirs=`find $rawdatapath -type d | grep -v timecorrlogs | sort -r`
    125 #
    126 #for dir in ${dirs[@]}
    127 #do
    128 #   cont=`echo $dir | cut -d/ -f7`
    129 #   if [ "$cont" == "" ]
    130 #   then
    131 #      continue
    132 #   fi
    133 #
    134 #   if ! ls $dir/*.raw >/dev/null 2>&1
    135 #   then
    136 #      echo "no unzipped rawfiles in $dir left"
    137 #      continue
    138 #   fi
    139 #
    140 #   echo "sleeping $sl1..."
    141 #   sleep $sl1
    142 #
    143 #   h=`date +%k`
    144 #   count=`grep gzip .condor_run.* | wc -l`
    145 #   echo "count: $count - h: $h - pno: ${pnos[$h]}"
    146 #   while [ "$count" -ge "${pnos[$h]}" ]
    147 #   do
    148 #      echo "sleeping $sl2..."
    149 #      sleep $sl2
    150 #      h=`date +%k`
    151 #      count=`grep gzip .condor_run.* | wc -l`
    152 #      echo "count: $count - h: $h - pno: ${pnos[$h]}"
    153 #   done
    154 #   echo $dir
    155 #   du -hs $dir
    156 #   condor_run gzip -1f $dir/*.raw &
    157 #
    158 #done
    159 #
    160 
  • trunk/MagicSoft/Mars/scripts/dospectrum

    r8230 r8482  
    151151for (( i=0 ; i < $par3num ; i++ ))
    152152do
    153   for (( j=0 ; j < $par1num ; j++ ))
    154   do
    155 #     echo "i: $i - j: $j ------- par1: $val1 and par3: $val3"
    156      dir=$resultpath/set${val1}_${val3}
    157      if ! ls $dir >/dev/null 2>&1
    158      then
    159         mkdir -pv $dir
    160      fi
    161 #     rcfile=$dir/ganymed_${val1}_${val3}_onoff.rc
    162      rcfile=$dir/`basename $ganymedrc`
    163      if ! ls $rcfile >/dev/null 2>&1
    164      then
    165         cat $ganymedrc | sed -e s/"${par1}"/"   ${val1}"/ -e s/"${par3}"/"  ${val3}"/ > $rcfile
    166      else
    167         echo "rcfile $rcfile already exists"
    168      fi
    169      val1=`echo $val1 + $par1step | bc`
    170   done
    171   val3=`echo $val3 + $par3step | bc`
    172   val1=$start1
     153   for (( j=0 ; j < $par1num ; j++ ))
     154   do
     155#      echo "i: $i - j: $j ------- par1: $val1 and par3: $val3"
     156      dir=$resultpath/set${val1}_${val3}
     157      if ! ls $dir >/dev/null 2>&1
     158      then
     159         mkdir -pv $dir
     160      fi
     161#      rcfile=$dir/ganymed_${val1}_${val3}_onoff.rc
     162      rcfile=$dir/`basename $ganymedrc`
     163      if ! ls $rcfile >/dev/null 2>&1
     164      then
     165         cat $ganymedrc | sed -e s/"${par1}"/"   ${val1}"/ -e s/"${par3}"/"  ${val3}"/ > $rcfile
     166      else
     167         echo "rcfile $rcfile already exists"
     168      fi
     169      val1=`echo $val1 + $par1step | bc`
     170   done
     171   val3=`echo $val3 + $par3step | bc`
     172   val1=$start1
    173173done
    174174
  • trunk/MagicSoft/Mars/scripts/makemovie

    r8473 r8482  
    2525# ========================================================================
    2626#
    27 #
    28 #
    2927##############################################################################
    3028#
     29# This script runs callisto with the -movie option and the corresponding
     30# rc files for a given sequence.
     31# The following movies are produced:
     32# - movieSequenceNumber[mc]-withoutcut.mpg (all events)
     33# - movieSequenceNumber[mc]-qualcut.mpg    (events after quality cuts)
     34# - movieSequenceNumber[mc]-areacut.mpg    (events after area cut)
     35# - movieSequenceNumber[mc]-thetacut.mpg   (events after theta^2 cut)
     36#
     37# If no outpath is given, the movies are stored in the directory movies.
     38#
     39# The script has to be executed in the Mars directory.
    3140#
    3241##############################################################################
     
    4352NumEvents=500
    4453Threshold=3
    45 
    46 #MFEvtNumber.FileName: ganymed00001218.root
    47 #MFEvtNumber.Selector: ThetaSquared.fVal<0.04 && DataType.fVal>0.5
    48 #MMovieWrite.Filename: movie-00071431-off-all.mpg
    49 
    5054
    5155function usage()
     
    8387do
    8488   case $1 in
    85            --sequ)  shift
    86                     sequence=$1
    87                     ;;
    88             --out)  shift
    89                     outpath=$1
    90                     ;;
    91   --target-length)  shift
    92                     TargetLength=$1
    93                     ;;
    94      --num-events)  shift
    95                     NumEvents=$1
    96                     ;;
    97           -wobble)  wobble='yes'
    98                     ;;
    99               -mc)  mc='mc'
    100                     ;;
    101                -h)  usage
    102                     ;;
    103       *)      echo "unknown option $1 "
    104               usage
    105               exit
    106               ;;
     89               --sequ)  shift
     90                        sequence=$1
     91                        ;;
     92                --out)  shift
     93                        outpath=$1
     94                        ;;
     95      --target-length)  shift
     96                        TargetLength=$1
     97                        ;;
     98         --num-events)  shift
     99                        NumEvents=$1
     100                        ;;
     101              -wobble)  wobble='yes'
     102                        ;;
     103                  -mc)  mc='mc'
     104                        ;;
     105                   -h)  usage
     106                        ;;
     107                *)      echo "unknown option $1 "
     108                        usage
     109                        exit
     110                        ;;
    107111   esac
    108112   shift
     
    239243for (( i=1 ; i < 4 ; i++ ))
    240244do
    241   command="./callisto $opts --config=$outpath2/callisto_$n8$mc-${names[$i]}.rc "
    242   echo "submitting: "$command
    243   condor_run $command &
     245   command="./callisto $opts --config=$outpath2/callisto_$n8$mc-${names[$i]}.rc "
     246   echo "submitting: "$command
     247   condor_run $command &
    244248done
    245249
  • trunk/MagicSoft/Mars/scripts/processsequence

    r8231 r8482  
    2020#   Author(s): Daniela Dorner  10/2006 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    8080          echo ""
    8181          ;;
    82      [1-9]|[0-9][0-9]|1[0-1][0-9]|12[0-7])
     82      [1-9]|[0-9][0-9]|1[0-1][0-9]|12[0-7])
    8383          echo -n "ERROR@$HOSTNAME: $program returned $check - please check the logfile $logfile"
    8484          if [ "$program" == "callisto" ]
     
    229229      mkdir -pv $merpplogpath
    230230
     231      date=`date --date \`basename $calfile | cut -d_ -f1 +%Y/%m/%d\``
     232      ccpath=$subsystempath/cc/$date
     233      cacopath=$subsystempath/caco/$date
    231234      runno=`echo $calfile | cut -d_ -f2 | sed -e 's/^0//' | sed -e 's/^0//' | sed -e 's/^0//' `
    232       ccfile=`find /magic/subsystemdata/cc/ -name 20[0-2][0-9][0,1][0-9][0-3][0-9]_*${runno}_[P,D,C,S]_*_S.rep`
    233       cacofile=`find /magic/subsystemdata/caco/ -name dc_20[0-2][0-9]_[01][0-9]_[0-3][0-9]_*${runno}_*.txt`
     235      ccfile=`find $ccpath -name 20[0-2][0-9][01][0-9][0-3][0-9]_*${runno}_[PDCS]_*_S.rep`
     236      source=`echo $ccfile | cut -d_ -f4`
     237      cacofile=`find /magic/subsystemdata/caco/$date -name dc_20[0-2][0-9]_[01][0-9]_[0-3][0-9]_*${runno}_${source}.txt`
    234238      echo "runno: "$runno
    235239      echo "ccfile: "$ccfile
     
    247251         do
    248252            newrun=`echo $runno - $i | bc`
    249      #      echo "$missingcacorun + $i = $newrun"
    250             path=`dirname $ccfile`
    251             path=`echo $path | sed -e 's/cc/caco/'`
    252             echo "path: "$path
    253             cacofile=`find $path -name *$newrun*`
     253            cacofile=`find $cacopath -name *$newrun*`
    254254            if [ "$cacofile" = "" ]
    255255            then
  • trunk/MagicSoft/Mars/steps.rc

    r8193 r8482  
    140140#SequenceProcessStatus.fCallisto:
    141141SequenceProcessStatus.fCallisto.Default: no
    142 SequenceProcessStatus.fCallisto.Needs: SequenceProcessStatus.fSequenceFileWritten SequenceProcessStatus.fAllFilesAvail
     142SequenceProcessStatus.fCallisto.Needs: SequenceProcessStatus.fSequenceFileWritten SequenceProcessStatus.fAllFilesAvail SequenceProcessStatus.fNotZipping
    143143SequenceProcessStatus.fCallisto.Influences: SequenceProcessStatus.fFillCallisto SequenceProcessStatus.fStar SequenceProcessStatus.fFillStar
    144144SequenceProcessStatus.fCallisto.Reset: yes
Note: See TracChangeset for help on using the changeset viewer.