Changeset 9355 for trunk/MagicSoft


Ignore:
Timestamp:
02/19/09 21:22:19 (16 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r9354 r9355  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20 2009/02/10 Daniela Dorner
     21
     22   * datacenter/scripts/buildsequenceentries,
     23     datacenter/scripts/checkfilesforsequenceavail,
     24     datacenter/scripts/checkstardone, datacenter/scripts/correcttime,
     25     datacenter/scripts/dbchk, datacenter/scripts/dodatacheck,
     26     datacenter/scripts/doexclusions, datacenter/scripts/fillcallisto,
     27     datacenter/scripts/fillcamera, datacenter/scripts/fillganymed,
     28     datacenter/scripts/fillstar, datacenter/scripts/insertdatasets,
     29     datacenter/scripts/makecallistolinks,
     30     datacenter/scripts/mcsequences, datacenter/scripts/movingrawfiles,
     31     datacenter/scripts/movingrawfiles_OK, datacenter/scripts/runcamera,
     32     datacenter/scripts/runcorsika, datacenter/scripts/runreflector,
     33     datacenter/scripts/sourcefile,
     34     datacenter/scripts/writedatasetfiles,
     35     datacenter/scripts/writesequencefiles:
     36     - removed scriptlog
     37
     38   * datacenter/scripts/jobmanager:
     39     - fixed typo
     40
     41
     42
    2043 2009/02/19 Thomas Bretz
    2144
  • trunk/MagicSoft/Mars/datacenter/scripts/buildsequenceentries

    r9215 r9355  
    4242set -C
    4343
    44 scriptlog=$runlogpath/$program-$datetime.log
    45 date >> $scriptlog 2>&1
    46 
    4744# check if script is already running
    4845lockfile=$lockpath/lock-$program.txt
    49 checklock  >> $scriptlog 2>&1
     46checklock
    5047
    5148# get todo list
    52 gettodo  >> $scriptlog 2>&1
     49gettodo
    5350
    5451cd $mars
     
    5855   date=${primaries[$s+$s]}
    5956   telnum=${primaries[$s+$s+1]}
    60    echo "building sequence entries for date $date..." >> $scriptlog 2>&1
    6157   printprocesslog "INFO build sequence entries for $date"
    6258   year2=`echo $date | cut -c 1-4`
    6359   buildsequentriespath=$logpath/$program/$year2
    64    makedir  $buildsequentriespath >> $scriptlog 2>&1
     60   makedir  $buildsequentriespath
    6561   buildsequentrieslog=$buildsequentriespath/buildsequenceentries-$date.log
    6662
    67    setstatus "start" >> $scriptlog 2>&1
     63   setstatus "start"
    6864
    6965   check1=`root -q -b $macrospath/buildsequenceentries.C+\("\"$date\""\,"\"$datapath\""\,"\"$sequpath\""\,$telnum\,kFALSE\) | tee $buildsequentrieslog | intgrep`
    7066
    7167   case $check1 in
    72       1)   echo " check1=$check1 -> everything ok -> setting status for $date..." >> $scriptlog 2>&1
    73            printprocesslog "INFO sequence entries successfully built for $date"
     68      1)   printprocesslog "INFO sequence entries successfully built for $date (check1=$check1)"
    7469           IFS=$'\n'
    7570           missing=( `grep "Missing" $buildsequentrieslog` )
     
    8378           unset IFS
    8479           ;;
    85       0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1
    86            printprocesslog "WARN connection to DB failed"
     80      0)   printprocesslog "WARN connection to DB failed (check1=$check1)"
    8781           check="no"
    8882           ;;
    89       *)   echo " check1=$check1 -> ERROR - $program.C failed for $date -> step has to be repeated" >> $scriptlog 2>&1
    90            printprocesslog "ERROR $program.C failed for $date"
     83      *)   printprocesslog "ERROR $program.C failed for $date (check1=$check1)"
    9184           com=$Fbuildsequ
    9285           check=$check1
     
    9487   esac
    9588
    96    setstatus "stop" >> $scriptlog 2>&1
     89   setstatus "stop"
    9790done
    9891
    99 finish >> $scriptlog 2>&1
     92finish
    10093
  • trunk/MagicSoft/Mars/datacenter/scripts/checkfilesforsequenceavail

    r9054 r9355  
    4242set -C
    4343
    44 scriptlog=$runlogpath/$program-$datetime.log
    45 date >> $scriptlog 2>&1
    46 
    4744# check if script is already running
    4845lockfile=$lockpath/lock-$program.txt
    49 checklock  >> $scriptlog 2>&1
     46checklock
    5047
    5148# get todo list
    52 gettodo  >> $scriptlog 2>&1
     49gettodo
    5350
    5451cd $mars
     
    5855   sequence=${primaries[$s+$s]}
    5956   telnum=${primaries[$s+$s+1]}
    60    echo "checking files for sequence $sequence..." >> $scriptlog 2>&1
    6157   printprocesslog "INFO checking files for sequence $sequence"
    6258   no=`printf %08d $sequence | cut -c 0-4`
    6359   no2=`printf %08d $sequence`
    6460   checkfileavailpath=$logpath/$program/$no
    65    makedir $checkfileavailpath  >> $scriptlog 2>&1
     61   makedir $checkfileavailpath
    6662   checkfileavaillog=$checkfileavailpath/$program-$no2.log
    6763
    68    setstatus "start" >> $scriptlog 2>&1
     64   setstatus "start"
    6965
    7066   check1=`root -q -b $macrospath/checkfileavail.C+\($sequence,$telnum\) | tee $checkfileavaillog | intgrep`
    7167
    7268   case $check1 in
    73       1)   echo " check1=$check1 -> everything ok -> setting status..." >> $scriptlog 2>&1
    74            printprocesslog "INFO files available for sequence $sequence"
     69      1)   printprocesslog "INFO files available for sequence $sequence (check1=$check1)"
    7570           ;;
    76       2)   echo " check1=$check1 -> files not yet available -> continue..." >> $scriptlog 2>&1
    77            printprocesslog "INFO files not yet available for sequence $sequence"
     71      2)   printprocesslog "INFO files not yet available for sequence $sequence (check1=$check1)"
    7872           check="no"
    7973           ;;
    80       0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1
    81            printprocesslog "WARN connection to DB failed"
     74      0)   printprocesslog "WARN connection to DB failed (check1=$check1)"
    8275           check="no"
    8376           ;;
    84       *)   echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
    85            printprocesslog "ERROR $program.C failed for sequence $sequence"
     77      *)   printprocesslog "ERROR $program.C failed for sequence $sequence (check1=$check1)"
    8678           com=$Ffilesavail
    8779           check=$check1
     
    8981   esac
    9082
    91    setstatus "stop" >> $scriptlog 2>&1
     83   setstatus "stop"
    9284done
    9385
    94 finish >> $scriptlog 2>&1
     86finish
    9587
  • trunk/MagicSoft/Mars/datacenter/scripts/checkstardone

    r9113 r9355  
    4040column=fStarFilesAvail
    4141
    42 scriptlog=$runlogpath/$program-$datetime.log
    43 date >> $scriptlog 2>&1
    44 
    4542# check if script is already running
    4643lockfile=$lockpath/lock-$program.txt
    47 checklock  >> $scriptlog 2>&1
     44checklock
    4845
    4946# get todo list
    50 gettodo  >> $scriptlog 2>&1
     47gettodo
    5148
    5249cd $mars
     
    5552do
    5653   dataset=${primaries[$s]}
    57    echo "checking star done for sequences of dataset $dataset..." >> $scriptlog 2>&1
    5854   printprocesslog "INFO checking star done for sequences of dataset $dataset"
    5955
    6056   outpath=$logpath/$program/`printf %08d $dataset | cut -c 0-5`
    61    makedir $outpath  >> $scriptlog 2>&1
     57   makedir $outpath
    6258
    63    setstatus "start" >> $scriptlog 2>&1
     59   setstatus "start"
    6460
    6561   check1=`root -q -b $macrospath/checkstardone.C+\($dataset\) | tee $outpath/checkstardone-$dataset.log | intgrep`
    6662
    6763   case $check1 in
    68       1)   echo " check1=$check1 -> everything ok -> continue with next dataset..." >> $scriptlog 2>&1 ;;
    69       2)   echo " check1=$check1 -> star files for dataset $dataset not yet available -> continue..." >> $scriptlog 2>&1
    70            printprocesslog "INFO files not yet available for dataset $dataset"
     64      1)   printprocesslog "INFO check1=$check1 -> everything ok -> continue with next dataset..."
     65      2)   printprocesslog "INFO files not yet available for dataset $dataset (check1=$check1)"
    7166           check="no"
    7267           ;;
    73       0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1
    74            printprocesslog "WARN connection to DB failed"
     68      0)   printprocesslog "WARN connection to DB failed (check1=$check1)"
    7569           check="no"
    7670           ;;
    77       *)   echo " check1=$check1 -> ERROR checkstardone.C failed for dataset $dataset" >> $scriptlog 2>&1
    78            printprocesslog "ERROR checkstardone.C failed for dataset $dataset"
     71      *)   printprocesslog "ERROR checkstardone.C failed for dataset $dataset (check1=$check1)"
    7972           com=$Fstardone
    8073           check=$check1
     
    8275   esac
    8376
    84    setstatus "stop" >> $scriptlog 2>&1
     77   setstatus "stop"
    8578done
    8679
    87 finish >> $scriptlog 2>&1
     80finish
  • trunk/MagicSoft/Mars/datacenter/scripts/correcttime

    r9046 r9355  
    3939source `dirname $0`/sourcefile
    4040printprocesslog "INFO starting $0"
    41 echo "This script has not been adapted to the new file structure (MAGIC II). "
     41echo "This script has not been adapted to the new file structure (MAGIC II) and new logging. "
    4242echo "Please adapt it before using it."
    4343exit
  • trunk/MagicSoft/Mars/datacenter/scripts/dbchk

    r9131 r9355  
    4646program=dbchk
    4747
    48 scriptlog=$runlogpath/$program-$datetime.log
    49 date >> $scriptlog 2>&1
    50 
    5148getdbsetup
    5249alias mymysql='mysql -s -u $us --password=$pw --host=$ho $db'
    5350
    5451# check for crashed nights, runs, sequences and datasets
    55 echo "Checking if something is crashed on nightly basis" >> $scriptlog 2>&1
     52printprocesslog "INFO Checking if something is crashed on nightly basis"
    5653nights=`echo "SELECT fDate FROM SequenceBuildStatus WHERE isnull(fFailedTime) and not isnull(fStartTime) and adddate(fStartTime, Interval 12 HOUR) < Now()" | mymysql`
    5754if [ ! "$nights" = "" ]
    5855then
    5956   printprocesslog "WARN For the following nights something seems to be crashed. Please check manually: $nights"
    60    echo "WARN For the following nights something  seems to be crashed. Please check manually: $nights" >> $scriptlog 2>&1
    6157else
    62    echo " Nothing found." >> $scriptlog 2>&1
     58   printprocesslog "INFO Nothing found."
    6359fi
    6460
    65 echo "Checking if something is crashed on run basis" >> $scriptlog 2>&1
     61printprocesslog "INFO Checking if something is crashed on run basis"
    6662cruns=`echo "SELECT fRunNumber FROM RunProcessStatus WHERE isnull(fFailedTime) and not isnull(fStartTime) and adddate(fStartTime, Interval 12 HOUR) < Now()" | mymysql`
    6763if [ ! "$cruns" = "" ]
    6864then
    6965   printprocesslog "WARN The following runs seem to be crashed. Please check manually: $cruns"
    70    echo "WARN The following runs seem to be crashed. Please check manually: $cruns" >> $scriptlog 2>&1
    7166else
    72    echo " Nothing found." >> $scriptlog 2>&1
     67   printprocesslog "INFO Nothing found."
    7368fi
    7469
    75 echo "Checking if something is crashed on sequence basis" >> $scriptlog 2>&1
     70printprocesslog "INFO Checking if something is crashed on sequence basis"
    7671csequences=`echo "SELECT fSequenceFirst FROM SequenceProcessStatus WHERE isnull(fFailedTime) and not isnull(fStartTime) and adddate(fStartTime, Interval 12 HOUR) < Now()" | mymysql`
    7772if [ ! "$csequences" = "" ]
    7873then
    7974   printprocesslog "WARN The following sequences seem to be crashed. Please check manually: $csequences"
    80    echo "WARN The following sequences seem to be crashed. Please check manually: $csequences" >> $scriptlog 2>&1
    8175else
    82    echo " Nothing found." >> $scriptlog 2>&1
     76   printprocesslog "INFO Nothing found."
    8377fi
    8478
    85 echo "Checking if something is crashed on dataset basis" >> $scriptlog 2>&1
     79printprocesslog "INFO Checking if something is crashed on dataset basis"
    8680cdatasets=`echo "SELECT fDataSetNumber FROM DataSetProcessStatus WHERE isnull(fFailedTime) and not isnull(fStartTime) and adddate(fStartTime, Interval 12 HOUR) < Now()"  | mymysql`
    8781if [ ! "$cdatasets" = "" ]
    8882then
    8983   printprocesslog "WARN The following datasets seem to be crashed. Please check manually: $cdatasets"
    90    echo "WARN The following datasets seem to be crashed. Please check manually: $cdatasets" >> $scriptlog 2>&1
    9184else
    92    echo " Nothing found." >> $scriptlog 2>&1
     85   printprocesslog "INFO Nothing found."
    9386fi
    9487
    9588# CHECK 1
    96 echo "Checking if all sequence files have a corresponding entry in Sequences" >> $scriptlog 2>&1
     89printprocesslog "INFO Checking if all sequence files have a corresponding entry in Sequences"
    9790files=`find $sequpath -type f`
    9891for file in $files
     
    10194   if [ "$sequence" = "" ] || [ "$sequence" = "$file" ]
    10295   then
    103       echo "No sequence file: $file" >> $scriptlog 2>&1
    10496      printprocesslog "ERROR No sequence file: $file"
    10597      continue
     
    109101   if ! [ "$sequence" = "$var" ]
    110102   then
    111       echo "Sequence-File $sequence exist but it is not in Sequences." >> $scriptlog 2>&1
    112103      printprocesslog "ERROR Sequence-File $sequence exists, but it is not in Sequences (DB)."
    113104      continue
     
    116107
    117108# CHECK 1b (callisto)
    118 echo "Checking if all sequences in ${datapath}/callisto have a corresponding sequence in Sequence" >> $scriptlog 2>&1
     109printprocesslog "INFO Checking if all sequences in ${datapath}/callisto have a corresponding sequence in Sequence"
    119110dirs=`find ${datapath}/callisto -mindepth 2 -maxdepth 2 -type d`
    120111for dir in $dirs
     
    123114   if [ "$sequence" = "" ] || [ "$sequence" = "$dir" ]
    124115   then
    125       echo "Invalid directory: $dir" >> $scriptlog 2>&1
    126116      printprocesslog "ERROR Invalid directory: $dir"
    127117      continue
     
    131121   if ! [ "$sequence" = "$var" ]
    132122   then
    133       echo "$dir exists but no corresponding sequence in Sequences." >> $scriptlog 2>&1
    134123      printprocesslog "ERROR $dir exists, but no corresponding sequence in Sequences (DB)."
    135124      continue
     
    138127
    139128# CHECK 1c (star)
    140 echo "Checking if all sequences in ${datapath}/star have a corresponding sequence in Sequence" >> $scriptlog 2>&1
     129printprocesslog "INFO Checking if all sequences in ${datapath}/star have a corresponding sequence in Sequence"
    141130dirs=`find ${datapath}/star -mindepth 2 -type d`
    142131for dir in $dirs
     
    145134   if [ "$sequence" = "" ] || [ "$sequence" = "$dir" ]
    146135   then
    147       echo "Invalid directory: $dir" >> $scriptlog 2>&1
    148136      printprocesslog "ERROR Invalid directory: $dir"
    149137      continue
     
    153141   if ! [ "$sequence" = "$var" ]
    154142   then
    155       echo "$dir exists but no corresponding sequence in Sequences." >> $scriptlog 2>&1
    156143      printprocesslog "ERROR $dir exists, but no corresponding sequence in Sequences (DB)."
    157144      continue
     
    160147
    161148# CHECK 2
    162 echo "Checking if all sequences in Sequences have a corresponding sequence files" >> $scriptlog 2>&1
     149printprocesslog "INFO Checking if all sequences in Sequences have a corresponding sequence files"
    163150sequences=`echo SELECT fSequenceFirst FROM Sequences left join SequenceProcessStatus using (fSequenceFirst,fTelescopeNumber) where not isnull(fSequenceFileWritten) | mymysql`
    164151for sequence in $sequences
     
    167154   if [ "$var" = "" ]
    168155   then
    169       echo "Sequence-File for $sequence not found but in db." >> $scriptlog 2>&1
    170156      printprocesslog "ERROR Sequence-File for $sequence not found but in DB."
    171157   fi
     
    173159
    174160# CHECK 3
    175 echo "Checking if all sequences from Sequences exist RunData" >> $scriptlog 2>&1
     161printprocesslog "INFO Checking if all sequences from Sequences exist RunData"
    176162sequences=`echo SELECT fSequenceFirst FROM Sequences GROUP BY fSequenceFirst | mymysql`
    177163for sequence in $sequences
     
    180166   if ! [ "$sequence" = "$res" ]
    181167   then
    182       echo "Sequence $sequence exists in Sequences but not in RunData." >> $scriptlog 2>&1
    183       printprocesslog "Sequence $sequence exists in Sequences but not in RunData (DB)."
     168      printprocesslog "ERROR Sequence $sequence exists in Sequences but not in RunData (DB)."
    184169      continue
    185170   fi
     
    187172
    188173# CHECK 4
    189 echo "Checking if all sequences from RunData exist in Sequences" >> $scriptlog 2>&1
     174printprocesslog "INFO Checking if all sequences from RunData exist in Sequences"
    190175sequences=`echo SELECT fSequenceFirst FROM RunData WHERE not fSequenceFirst=0 GROUP BY fSequenceFirst | mymysql`
    191176for sequence in $sequences
     
    194179   if ! [ "$sequence" = "$var" ]
    195180   then
    196       echo "Sequence $sequence exists in RunData but not in Sequences." >> $scriptlog 2>&1
    197       printprocesslog "Sequence $sequence exists in RunData but not in Sequences (DB)."
     181      printprocesslog "ERROR Sequence $sequence exists in RunData but not in Sequences (DB)."
    198182      continue
    199183   fi
     
    201185
    202186# CHECK 5
    203 echo "Checking if all sequences from RunData exist in SequenceProcessStatus" >> $scriptlog 2>&1
     187printprocesslog "INFO Checking if all sequences from RunData exist in SequenceProcessStatus"
    204188sequences=`echo SELECT fSequenceFirst FROM RunData WHERE not fSequenceFirst=0 GROUP BY fSequenceFirst | mymysql`
    205189for sequence in $sequences
     
    208192   if ! [ "$sequence" = "$var" ]
    209193   then
    210       echo "Sequence $sequence exists in RunData but not in SequenceProcessStatus." >> $scriptlog 2>&1
    211       printprocesslog "Sequence $sequence exists in RunData but not in SequenceProcessStatus (DB)."
     194      printprocesslog "ERROR Sequence $sequence exists in RunData but not in SequenceProcessStatus (DB)."
    212195      continue
    213196   fi
    214197done
    215198
    216 finish >> $scriptlog 2>&1
     199finish
  • trunk/MagicSoft/Mars/datacenter/scripts/dodatacheck

    r9223 r9355  
    4141source `dirname $0`/sourcefile
    4242printprocesslog "INFO starting $0"
    43 echo "This script has not been adapted to the new file structure (MAGIC II). "
     43echo "This script has not been adapted to the new file structure (MAGIC II) and new logging. "
    4444echo "Only the usage of getodo has been adapted, but not tested."
    4545echo "Please adapt it before using it."
  • trunk/MagicSoft/Mars/datacenter/scripts/doexclusions

    r9054 r9355  
    4242set -C
    4343
    44 scriptlog=$runlogpath/$program-$datetime.log
    45 date >> $scriptlog 2>&1
    46 
    4744# check if the script is already running
    4845lockfile=$lockpath/lock-$program.txt
    49 checklock  >> $scriptlog 2>&1
     46checklock
    5047
    5148# get todo list
    52 gettodo  >> $scriptlog 2>&1
     49gettodo
    5350
    5451cd $mars
     
    5956   date=${primaries[$s+$s]}
    6057   telnum=${primaries[$s+$s+1]}
    61    echo "do exclusions for date "$date >> $scriptlog 2>&1
    62    printprocesslog "INFO do exclusions for $date"
     58   printprocesslog "INFO do exclusions for $date $date"
    6359   year2=`echo $date | cut -c 1-4`
    6460   doexclusionspath=$logpath/$program/$year2
    65    makedir $doexclusionspath >> $scriptlog 2>&1
     61   makedir $doexclusionspath
    6662   doexclusionslog=$doexclusionspath/doexclusions-$date.log
    6763
    68    setstatus "start" >> $scriptlog 2>&1
     64   setstatus "start"
    6965
    7066   check1=`root -q -b $macrospath/doexclusions.C+\("\"$date\""\,$telnum\,kFALSE\) | tee $doexclusionslog | intgrep`
    7167
    7268   case $check1 in
    73       1)   echo " check1=$check1 -> everything ok -> setting status..." >> $scriptlog 2>&1
    74            printprocesslog "INFO exclusions successfully done for $date"
     69      1)   printprocesslog "INFO exclusions successfully done for $date (check1=$check1)"
    7570           ;;
    76       0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1
    77            printprocesslog "WARN connection to DB failed"
     71      0)   printprocesslog "WARN connection to DB failed (check1=$check1)"
    7872           check="no"
    7973           ;;
    80       *)   echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
    81            printprocesslog "ERROR $program.C failed"
     74      *)   printprocesslog "ERROR $program.C failed (check1=$check1)"
    8275           com=$Fdoexcl
    8376           check=$check1
     
    8578   esac
    8679   
    87    setstatus "stop" >> $scriptlog 2>&1
     80   setstatus "stop"
    8881done
    8982
    90 finish >> $scriptlog 2>&1
     83finish
    9184
  • trunk/MagicSoft/Mars/datacenter/scripts/fillcallisto

    r9054 r9355  
    4343set -C
    4444
    45 scriptlog=$runlogpath/$program-$datetime.log
    46 date >> $scriptlog 2>&1
    47 
    4845# check if the script is already running
    4946lockfile=$lockpath/lock-$program.txt
    50 checklock  >> $scriptlog 2>&1
     47checklock
    5148
    5249# get todo file
    53 gettodo  >> $scriptlog 2>&1
     50gettodo
    5451
    5552cd $mars
     
    6764   calibfile=$path/calib$no2.root
    6865   fillcallistologpath=$logpath/$program/$no
    69    makedir $fillcallistologpath >> $scriptlog 2>&1
     66   makedir $fillcallistologpath
    7067   fillcaliblog=$fillcallistologpath/fillcalib-$sequence.log
    7168   fillsignallog=$fillcallistologpath/fillsignal-$sequence.log
    7269
    73    echo "run $program for sequence $sequence" >> $scriptlog 2>&1
    74    setstatus "start" >> $scriptlog 2>&1
    75    echo "run fillcalib..." >> $scriptlog 2>&1
     70   printprocesslog "INFO run $program for sequence $sequence"
     71   setstatus "start"
    7672   printprocesslog "INFO starting fillcalib for sequence $sequence"
    7773
     
    7975
    8076   case $check1 in
    81       1)   echo " check1=$check1 -> everything ok -> run fillsignal " >> $scriptlog 2>&1
    82            printprocesslog "INFO done fillcalib successfully for sequence $sequence"
     77      1)   printprocesslog "INFO done fillcalib successfully for sequence $sequence (check1=$check1)"
    8378           ;;
    84       0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1
    85            printprocesslog "WARN connection to DB failed"
     79      0)   printprocesslog "WARN connection to DB failed (check1=$check1)"
    8680           check="no"
    87            setstatus "stop" >> $scriptlog 2>&1
     81           setstatus "stop"
    8882           continue ;;
    89       *)   echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
    90            printprocesslog "ERROR fillcalib failed for sequence $sequence"
     83      *)   printprocesslog "ERROR fillcalib failed for sequence $sequence (check1=$check1)"
    9184           com=$Ffillcalib
    9285           check=$check1
    93            setstatus "stop" >> $scriptlog 2>&1
     86           setstatus "stop"
    9487           continue ;;
    9588   esac
     
    9891   check2=`root -q -b $macrospath/fillsignal.C+\("\"$signalfile\""\,kFALSE\) | tee $fillsignallog | intgrep`
    9992   case $check2 in
    100       1)   echo " check2=$check2 -> everything ok " >> $scriptlog 2>&1
    101            printprocesslog "INFO done fillsignal successfully for sequence $sequence"
     93      1)   printprocesslog "INFO done fillsignal successfully for sequence $sequence (check2=$check2)"
    10294           ;;
    103       0)   echo " check2=$check2 -> no connection to db -> continue..." >> $scriptlog 2>&1
    104            printprocesslog "WARN connection to DB failed"
     95      0)   printprocesslog "WARN connection to DB failed (check2=$check2)"
    10596           check="no"
    10697           ;;
    107       *)   echo " check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
    108            printprocesslog "ERROR fillsignal failed for sequence $sequence"
     98      *)   printprocesslog "ERROR fillsignal failed for sequence $sequence (check2=$check2)"
    10999           com=$Ffillsignal
    110100           check=$check2
     
    112102   esac
    113103   
    114    setstatus "stop" >> $scriptlog 2>&1
     104   setstatus "stop"
    115105done
    116106
    117 finish >> $scriptlog 2>&1
     107finish
    118108
  • trunk/MagicSoft/Mars/datacenter/scripts/fillcamera

    r9217 r9355  
    1 #!/bin/sh
     1        #!/bin/sh
    22#
    33# ========================================================================
     
    3535set -C
    3636
    37 scriptlog=$runlogpath/$program-$datetime.log
    38 date >> $scriptlog 2>&1
    39 
    4037# check if script is already running
    4138lockfile=$lockpath/lock-$program.txt
    42 checklock  >> $scriptlog 2>&1
     39checklock
    4340
    4441getdbsetup
     
    4845#workaround
    4946cameradirs=`find /magic/montecarlo/camera -maxdepth 4 -mindepth 2 -type d ! -name Gamma ! -name Muon ! -name Proton ! -name Spot_?.?`
    50 echo "camera dirs: "${cameradirs[@]}  >> $scriptlog 2>&1
    51 echo "" >> $scriptlog 2>&1
     47printprocesslog "INFO camera dirs: "${cameradirs[@]}
    5248
    5349cd $mars
     
    6662   fi
    6763   epo=`echo $cameradir | cut -d/ -f5` #epoch
    68    echo "dir: "$cameradir >> $scriptlog 2>&1
     64   printprocesslog "INFO dir: "$cameradir
    6965   fillcamerapath=$logpath/$program
    70    makedir $fillcamerapath >> $scriptlog 2>&1
     66   makedir $fillcamerapath
    7167   fillcameralog=$fillcamerapath/$program-$epo-$par-$spot-$cam.log
    7268   
     
    7470#   check0=`root -q -b $macrospath/fillcamera.C+\("\"$cameradir\""\,kTRUE\) | tee $fillcameralog | intgrep`
    7571   case $check0 in
    76       1)   echo "check0=$check0 -> everything ok " >> $scriptlog 2>&1
    77            printprocesslog "INFO fillcamera run successfully for dir $cameradir"
     72      1)   printprocesslog "INFO fillcamera run successfully for dir $cameradir (check0=$check0)"
    7873           ;;
    79       0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1
    80            printprocesslog "WARN connection to DB failed"
     74      0)   printprocesslog "WARN connection to DB failed (check0=$check0)"
    8175           check="no"
    8276           ;;
    83       *)   echo "check0=$check0 -> ERROR " >> $scriptlog 2>&1
    84            printprocesslog "ERROR $program.C failed for dir $cameradir"
     77      *)   printprocesslog "ERROR $program.C failed for dir $cameradir (check0=$check0)"
    8578           ;;
    8679   esac
    8780   
    8881   printprocesslog "INFO linking cal and ped files"
    89    echo "linking cal and ped files" >> $scriptlog 2>&1
    9082   
    9183   if [ $cam = "Cal_and_Ped" ];
    9284   then
    93       echo "Cal_and_Ped folder, no cal and ped files will be linked" >> $scriptlog 2>&1
     85      printprocesslog "INFO Cal_and_Ped folder, no cal and ped files will be linked"
    9486   else
    9587
     
    9991      calfile=`find $mccampath/$epo/Cal_and_Ped -name *_C_*.root`
    10092   
    101       echo "calfile for epoch $epo : " $calfile >> $scriptlog 2>&1
    102       echo "pedfile for epoch $epo : " $pedfile >> $scriptlog 2>&1
     93      printprocesslog "INFO calfile for epoch $epo : " $calfile
     94      printprocesslog "INFO pedfile for epoch $epo : " $pedfile
    10395   
    10496      #check number of files
     
    10799      if [ "$numfiles" != "2" ]
    108100      then
    109         echo "too many or too less files in the directory $epo/Cal_and_Ped -> exit" >> $scriptlog 2>&1
    110         rm -v $lockfile >> $scriptlog 2>&1
    111         exit
    112         printprocesslog "ERROR too many ped and cal files found in $epo/Cal_and_Ped"
    113         finish >> $scriptlog 2>&1
     101        printprocesslog "ERROR too many or too less ped and cal files found in $epo/Cal_and_Ped"
     102        finish
    114103      fi
    115104     
     
    122111      cnum=`printf %08d $crun`
    123112      pnum=`printf %08d $prun`
    124       echo "calrun number: " $cnum >> $scriptlog 2>&1
    125       echo "pedrun number: " $pnum >> $scriptlog 2>&1
     113      printprocesslog "INFO calrun number: " $cnum
     114      printprocesslog "INFO pedrun number: " $pnum
    126115      #get all directories in the linked structure for the epoch
    127116      #dirs=`find $mcrawpath/ -mindepth 3 -maxdepth 3 -type d`
     
    142131         if ls $dir | grep MonteCarlo | grep $pnum
    143132         then
    144             echo "P run already there, do mysql update" >> $scriptlog 2>&1
     133            printprocesslog "INFO P run already there, do mysql update"
    145134   #         continue
    146135            mysql -ss -u $us --password=$pw --host=$ho $db -e " $pupdate "
    147136         else
    148             echo "linking P run for epoch $epo" >> $scriptlog 2>&1
    149             ln -sv $pedfile $newpedfile >> $scriptlog 2>&1
     137            printprocesslog "INFO linking P run for epoch $epo"
     138            ln -sv $pedfile $newpedfile
    150139            mysql -ss -u $us --password=$pw --host=$ho $db -e " $pupdate "
    151140         fi
     
    153142         if ls $dir | grep MonteCarlo | grep $cnum
    154143         then
    155             echo "C run already there, do mysql update" >> $scriptlog 2>&1
     144            printprocesslog "INFO C run already there, do mysql update"
    156145   #         continue
    157146            mysql -ss -u $us --password=$pw --host=$ho $db -e " $cupdate "
    158147         else
    159             echo "linking C run for epoch $epo" >> $scriptlog 2>&1
    160             ln -sv $calfile $newcalfile >> $scriptlog 2>&1
     148            printprocesslog "INFO linking C run for epoch $epo"
     149            ln -sv $calfile $newcalfile
    161150            mysql -ss -u $us --password=$pw --host=$ho $db -e " $cupdate "
    162151         fi
     
    211200
    212201
    213 finish >> $scriptlog 2>&1
    214 
     202finish
     203
  • trunk/MagicSoft/Mars/datacenter/scripts/fillganymed

    r9133 r9355  
    4242set -C
    4343
    44 scriptlog=$runlogpath/$program-$datetime.log
    45 date >> $scriptlog 2>&1
    46 
    4744# check if script is already running
    4845lockfile=$lockpath/lock-$program.txt
    49 checklock  >> $scriptlog 2>&1
     46checklock
    5047
    5148# get todo list
    52 gettodo  >> $scriptlog 2>&1
     49gettodo
    5350
    5451cd $mars
     
    6461   ganymedfile=$path/ganymed$no2.root
    6562   fillganymedlogpath=$logpath/$program/$no
    66    makedir $fillganymedlogpath >> $scriptlog 2>&1
     63   makedir $fillganymedlogpath
    6764   fillganymedlog=$fillganymedlogpath/$program-$dataset.log
    6865
    69    echo "run $program for dataset $dataset" >> $scriptlog 2>&1
    70    setstatus "start" >> $scriptlog 2>&1
     66   printprocesslog "INFO run $program for dataset $dataset"
     67   setstatus "start"
    7168
    7269   check2=`root -q -b $macrospath/fillganymed.C+\("\"$ganymedfile\""\,kFALSE\) | tee $fillganymedlog | intgrep`
    7370   case $check2 in
    74       1)   echo " check2=$check2 -> everything ok " >> $scriptlog 2>&1
    75            printprocesslog "INFO done fillganymed successfully for dataset $dataset"
     71      1)   printprocesslog "INFO done fillganymed successfully for dataset $dataset (check2=$check2)"
    7672           ;;
    77       0)   echo " check2=$check2 -> no connection to db -> continue..." >> $scriptlog 2>&1
    78            printprocesslog "WARN connection to DB failed"
     73      0)   printprocesslog "WARN connection to DB failed (check2=$check2)"
    7974           check="no"
    8075           ;;
    81       *)   echo " check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
    82            printprocesslog "ERROR fillganymed failed for dataset $datset"
     76      *)   printprocesslog "ERROR fillganymed failed for dataset $datset (check2=$check2)"
    8377           com=$Ffillganymed
    8478           check=$check2
     
    8680   esac
    8781
    88    setstatus "stop" >> scriptlog 2>&1
     82   setstatus "stop"
    8983done
    9084
    91 finish >> $scriptlog 2>&1
     85finish
    9286
  • trunk/MagicSoft/Mars/datacenter/scripts/fillstar

    r9054 r9355  
    4242set -C
    4343
    44 scriptlog=$runlogpath/$program-$datetime.log
    45 date >> $scriptlog 2>&1
    46 
    4744# check if the script is already running
    4845lockfile=$lockpath/lock-$program.txt
    49 checklock  >> $scriptlog 2>&1
     46checklock
    5047
    5148# get todo list
    52 gettodo  >> $scriptlog 2>&1
     49gettodo
    5350
    5451cd $mars
     
    6562   starfile=$path/star$no2.root
    6663   fillstarlogpath=$logpath/$program/$no
    67    makedir $fillstarlogpath >> $scriptlog 2>&1
     64   makedir $fillstarlogpath
    6865   fillstarlog=$fillstarlogpath/$program-$sequence.log
    6966
    70    echo "run $program for sequence $sequence" >> $scriptlog 2>&1
    71    setstatus "start" >> $scriptlog 2>&1
     67   setstatus "start"
    7268
    7369   check2=`root -q -b $macrospath/fillstar.C+\("\"$starfile\""\,kFALSE\) | tee $fillstarlog | intgrep`
    7470   case $check2 in
    75       1)   echo " check2=$check2 -> everything ok " >> $scriptlog 2>&1
    76            printprocesslog "INFO done fillstar successfully for sequence $sequence"
     71      1)   printprocesslog "INFO done fillstar successfully for sequence $sequence (check2=$check2)"
    7772           ;;
    78       0)   echo " check2=$check2 -> no connection to db -> continue..." >> $scriptlog 2>&1
    79            printprocesslog "WARN connection to DB failed"
     73      0)   printprocesslog "WARN connection to DB failed (check2=$check2)"
    8074           check="no"
    8175           ;;
    82       *)   echo " check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
    83            printprocesslog "ERROR fillstar failed for sequence $sequence"
     76      *)   printprocesslog "ERROR fillstar failed for sequence $sequence (check2=$check2)"
    8477           com=$Ffillstar
    8578           check=$check2
     
    8780   esac
    8881   
    89    setstatus "stop" >> $scriptlog 2>&1
     82   setstatus "stop"
    9083done
    9184
    92 finish >> $scriptlog 2>&1
     85finish
    9386
  • trunk/MagicSoft/Mars/datacenter/scripts/insertdatasets

    r8482 r9355  
    3838set -C
    3939
    40 scriptlog=$runlogpath/$program-$datetime.log
    41 date >> $scriptlog 2>&1
    42 
    4340# check if script is already running
    4441lockfile=$lockpath/lock-$program.txt
    45 checklock  >> $scriptlog 2>&1
     42checklock
    4643
    4744# get all datasetfiles
    4845datasetfiles=(`ls $datasetpath/*/*.txt`)
    49 echo "datasetfiles: "${datasetfiles[@]}  >> $scriptlog 2>&1
    50 echo "" >> $scriptlog 2>&1
     46printprocesslog "INFO datasetfiles: "${datasetfiles[@]}
    5147
    5248cd $mars
     
    6662   if [ "$no" = "$no3" ]
    6763   then
    68       echo "number in filename and in file are the same -> continue" >> $scriptlog 2>&1
     64      printprocesslog "INFO number in filename and in file are the same -> continue"
    6965   else
    70       echo "number in filename and in file are not the same " >> $scriptlog 2>&1
    71       echo " -> continue with next dataset" >> $scriptlog 2>&1
    7266      printprocesslog "ERROR number in filename ($no) and file ($no3) are not the same for dataset $no2"
    7367      continue
    7468   fi
    7569   # get source name, comment and observation mode from dataset file
    76    source=`grep 'SourceName:' $datasetfile | sed -e 's/SourceName://g' | sed -e 's/ //g' | sed -e 's/#//g'` >> $scriptlog 2>&1
    77    comment=`grep 'Comment:' $datasetfile | sed -e 's/Comment://g'` >> $scriptlog 2>&1
    78    mode=`grep 'WobbleMode:' $datasetfile` >> $scriptlog 2>&1
    79    mode2=`echo $mode | grep ^\#` >> $scriptlog 2>&1
     70   source=`grep 'SourceName:' $datasetfile | sed -e 's/SourceName://g' | sed -e 's/ //g' | sed -e 's/#//g'`
     71   comment=`grep 'Comment:' $datasetfile | sed -e 's/Comment://g'`
     72   mode=`grep 'WobbleMode:' $datasetfile`
     73   mode2=`echo $mode | grep ^\#`
    8074   if [ "$mode2" = "" ]
    8175   then
    82       wobble="Y" >> $scriptlog 2>&1
     76      wobble="Y"
    8377   else
    84       wobble="N" >> $scriptlog 2>&1
     78      wobble="N"
    8579   fi
    86    echo "file: "$datasetfile >> $scriptlog 2>&1
    87    echo "  datasetno:  "$no2 >> $scriptlog 2>&1
    88    echo "  sourcename: "$source >> $scriptlog 2>&1
    89    echo "  wobble:     "$wobble >> $scriptlog 2>&1
    90    echo "  comment:    "$comment >> $scriptlog 2>&1
    91    echo " " >> $scriptlog 2>&1
    9280   
    9381   insertdatasetpath=$logpath/insertdataset/$no4
    94    makedir $insertdatasetpath >> $scriptlog 2>&1
     82   makedir $insertdatasetpath
    9583   insertdatasetlog=$insertdatasetpath/insertdataset-$no3.log
    9684
     
    9987   check0=`root -q -b $macrospath/insertdataset.C+\("\"$no2\""\,"\"$source\""\,"\"$wobble\""\,"\"$comment\""\,kFALSE\) | tee $insertdatasetlog | intgrep`
    10088   case $check0 in
    101       1)   echo " check0=$check0 -> everything ok " >> $scriptlog 2>&1
    102            printprocesslog "INFO dataset $no2 successfully inserted"
     89      1)   printprocesslog "INFO dataset $no2 successfully inserted (check0=$check0)"
    10390           ;;
    104       3)   echo " check0=$check0 -> everything ok " >> $scriptlog 2>&1
    105            printprocesslog "INFO dataset $no2 exists already"
     91      3)   printprocesslog "INFO dataset $no2 exists already (check0=$check0)"
    10692           ;;
    107       0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1
    108            printprocesslog "WARN connection to DB failed"
     93      0)   printprocesslog "WARN connection to DB failed (check0=$check0)"
    10994           check="no"
    11095           ;;
    111       *)   echo " check0=$check0 -> ERROR " >> $scriptlog 2>&1
    112            printprocesslog "ERROR $program.C failed for dataset $no2"
     96      *)   printprocesslog "ERROR $program.C failed for dataset $no2 (check0=$check0)"
    11397           ;;
    11498   esac
    11599done
    116100
    117 finish >> $scriptlog 2>&1
     101finish
    118102
  • trunk/MagicSoft/Mars/datacenter/scripts/jobmanager

    r9129 r9355  
    9797      column=${scriptscolname[$i]}
    9898      getstatus >> $jmscriptlog 2>&1
    99       echo " $numproc ${scripts[$i]} still do to" >> $jmscriptlog 2>&1
     99      echo " $numproc ${scripts[$i]} still to do" >> $jmscriptlog 2>&1
    100100      if [ "$numproc" = "" ]
    101101      then
  • trunk/MagicSoft/Mars/datacenter/scripts/makecallistolinks

    r9107 r9355  
    4141set -C
    4242
    43 scriptlog=$runlogpath/$program`date +%F`.log
    44 date >> $scriptlog 2>&1
    45 
    4643# check if script is already running
    4744lockfile=$lockpath/lock-$program.txt
    48 checklock  >> $scriptlog 2>&1
     45checklock
    4946
    5047callistorcseq=callisto.rc
     
    5653if [ ${#primaries[@]} -eq 0 ]
    5754then
    58    echo "nothing to do -> exit"  >> $scriptlog 2>&1
    59    finish >> $scriptlog 2>&1
     55   printprocesslog "INFO nothing to do -> exit"
     56   finish
    6057fi
    6158num=`expr ${#primaries[@]} / 2 `
     
    6966   telnum=${primaries[$s+$s+1]}
    7067   callistorc=$datapath/callisto/`printf %08d $sequence | cut -c 0-4`/`printf %08d $sequence`/$callistorcseq
    71    if ! ls -l $callistorc 2>/dev/null | grep $callistorcnew >> $scriptlog 2>&1
     68   if ! ls -l $callistorc 2>/dev/null | grep $callistorcnew
    7269   then
    7370      printprocesslog "INFO linking $callistorcnew to $callistorc for sequ $sequence"
    7471      # resetting the calibration
    75       echo "resetting the callisto for sequence $sequence" >> $scriptlog 2>&1
     72      printprocesslog "INFO resetting the callisto for sequence $sequence"
    7673
    7774      query="UPDATE SequenceProcessStatus set fStartTime=NULL, fFailedTime=NULL, fProgramId=NULL, fReturnCode=NULL where fSequenceFirst=$sequence and fTelescopeNumber=$telnum"
    78       if ! sendquery >> $scriptlog 2>&1
     75      if ! sendquery
    7976      then
    8077         printprocesslog "ERROR resetting calibration failed for sequence $sequence"
     
    8582     
    8683      #linking callisto.rc
    87       if ln -vfs $setuppath/callisto/$callistorcnew $callistorc >> $scriptlog 2>&1
     84      if ln -vfs $setuppath/callisto/$callistorcnew $callistorc
    8885      then
    8986         printprocesslog "INFO link callisto.rc successfully for sequence $sequence"
     
    9592done
    9693
    97 finish >> $scriptlog 2>&1
     94finish
    9895
  • trunk/MagicSoft/Mars/datacenter/scripts/mcsequences

    r9225 r9355  
    3737set -C
    3838
    39 scriptlog=$runlogpath/$program-$datetime.log
    40 date >> $scriptlog 2>&1
    41 
    4239# check if script is already running
    4340lockfile=$lockpath/lock-$program.txt
    44 checklock  >> $scriptlog 2>&1
     41checklock
    4542                                             
    4643# find montecarlo directories, build two sequences per directory and write sequence files
     
    5855      continue
    5956   fi
    60    echo $dir >> $scriptlog 2>&1
     57   printprocesslog "INFO dir: "$dir
    6158   
    6259   epochs=`ls -l $mcpath/camera | cut -c 52-80`
    6360   for epoch in ${epochs[@]}
    6461   do
    65       echo $epoch >> $scriptlog 2>&1
     62      printprocesslog "INFO epoch: "$epoch
    6663      calfile=`find $dir -lname *${epoch}/*.root | grep "_C_"`
    6764      pedfile=`find $dir -lname *${epoch}/*.root | grep "_P_"`
     
    140137            trainno=`echo $firstruntrain | cut -c 0-4`
    141138            trainsequpath=$mcsequpath/$trainno
    142             makedir $trainsequpath >> $scriptlog 2>&1
     139            makedir $trainsequpath
    143140            trainsequfile=$trainsequpath/sequence$firstruntrain.txt
    144             echo "writing train sequfile "$trainsequfile >> $scriptlog 2>&1
    145141            printprocesslog "INFO writing train sequencefile $trainsequfile"
    146142   
     
    205201            testno=`echo $firstruntest | cut -c 0-4`
    206202            testsequpath=$mcsequpath/$testno
    207             makedir $testsequpath >> $scriptlog 2>&1
     203            makedir $testsequpath
    208204            testsequfile=$testsequpath/sequence$firstruntest.txt
    209             echo "writing test sequfile "$testsequfile >> $scriptlog 2>&1
    210205            printprocesslog "INFO writing test sequencefile $testsequfile"
    211206   
     
    227222done
    228223
    229 finish >> $scriptlog 2>&1
    230 
     224finish
     225
  • trunk/MagicSoft/Mars/datacenter/scripts/movingrawfiles

    r9198 r9355  
    4141umask 0002
    4242
    43 scriptlog=$runlogpath/$program-$datetime.log
    44 date >> $scriptlog 2>&1
    45 
    4643# check whether script is already running
    4744lockfile=$lockpath/lock-$program.txt
    48 checklock  >> $scriptlog 2>&1
     45checklock
    4946
    5047# change permission for files
    51 ssh tape@dc07 chmod -R g+w /magic/datacenter/fromtape/rawdata/* >> $scriptlog 2>&1
     48ssh tape@dc07 chmod -R g+w /magic/datacenter/fromtape/rawdata/*
    5249
    5350# find rawfiles belonging to tape (don't move files not yet md5-sum checked)
     
    5653if [ "$rawfiles" == "" ]
    5754then
    58    echo "no files to move -> exit" >> $scriptlog 2>&1
    59    finish >> $scriptlog 2>&1
     55   printprocesslog "INFO no files to move -> exit"
     56   finish
    6057fi
    6158
     
    7572      newrawfile=`echo $rawfile | sed -e 's/\/fromtape\/muxdata//g' -e 's/_/\//1' -e 's/_/\//1'`
    7673   else
    77       echo "ERROR something is wrong with the path of file $rawfile -> continue" >> $scriptlog 2>&1
    7874      printprocesslog "ERROR moving rawfile $rawfile failed"
    7975      continue
     
    8177   
    8278   newdir=`dirname $newrawfile`
    83    makedir $newdir >> $scriptlog 2>&1
     79   makedir $newdir
    8480   
    85    mv -v $rawfile $newrawfile >> $scriptlog 2>&1
     81   mv -v $rawfile $newrawfile
    8682done
    8783
    88 rmdir -v /magic/{datacenter,data/rawfiles}/fromtape/???data/* >> $scriptlog 2>&1
     84rmdir -v /magic/{datacenter,data/rawfiles}/fromtape/???data/*
    8985
    9086printprocesslog "INFO launching filesondisk"
    91 echo "launching filesondisk" >> $scriptlog 2>&1
    9287$scriptspath/filesondisk &
    9388
    94 finish >> $scriptlog 2>&1
     89finish
  • trunk/MagicSoft/Mars/datacenter/scripts/movingrawfiles_OK

    r8685 r9355  
    4343umask 0002
    4444
    45 scriptlog=$runlogpath/$program-$datetime.log
    46 date >> $scriptlog 2>&1
    47 
    4845# check whether script is already running
    4946lockfile=$lockpath/lock-$program.txt
    50 checklock  >> $scriptlog 2>&1
     47checklock
    5148
    5249# change permission for files
    53 ssh tape@dc07 chmod -R g+w /magic/datacenter/fromtape/rawdata/* >> $scriptlog 2>&1
    54 ssh lapalma@dc09 chmod -R g+w /magic/datacenter/fromlapalma/RAW*/ >> $scriptlog 2>&1
     50ssh tape@dc07 chmod -R g+w /magic/datacenter/fromtape/rawdata/*
     51ssh lapalma@dc09 chmod -R g+w /magic/datacenter/fromlapalma/RAW*/
    5552# output for chmod with -v or -c (only changes)
    5653
     
    6158then
    6259   # change permission for this directories
    63    ssh lapalma@dc09 chmod -R g+w $dirs >> $scriptlog 2>&1
     60   ssh lapalma@dc09 chmod -R g+w $dirs
    6461   # move directories to the tapedirectory
    6562   dates=`find /magic/datacenter/fromlapalma/RAW/*200* -type d | cut -d/ -f6`
    6663   for date in ${dates[@]}
    6764   do
    68         ssh lapalma@dc09 mkdir /magic/datacenter/fromlapalma/RAWchk/$date >> $scriptlog 2>&1
    69         makedir /magic/datacenter/fromtape/rawdata/$date >> $scriptlog 2>&1
     65        ssh lapalma@dc09 mkdir /magic/datacenter/fromlapalma/RAWchk/$date
     66        makedir /magic/datacenter/fromtape/rawdata/$date
    7067       
    7168        OKs=`ls /magic/datacenter/fromlapalma/RAW/$date/*.OK`
    7269        for OK in ${OKs[@]}
    7370        do
    74                 ssh lapalma@dc09 mv -v $OK /magic/datacenter/fromlapalma/RAWchk/$date/ >> $scriptlog 2>&1
     71                ssh lapalma@dc09 mv -v $OK /magic/datacenter/fromlapalma/RAWchk/$date/
    7572                files=`echo $OK | sed -e 's/.OK//g'`
    76                 mv -v $files /magic/datacenter/fromtape/rawdata/$date/ >> $scriptlog 2>&1
     73                mv -v $files /magic/datacenter/fromtape/rawdata/$date/
    7774        done
    7875   done
    7976fi
    8077
    81 rmdir -v /magic/datacenter/fromlapalma/RAW/*200* >> $scriptlog 2>&1
     78rmdir -v /magic/datacenter/fromlapalma/RAW/*200*
    8279
    8380# find rawfiles
     
    8683if [ "$rawfiles" == "" ]
    8784then
    88    echo "no files to move -> exit" >> $scriptlog 2>&1
    89    finish >> $scriptlog 2>&1
     85   printprocesslog "INFO no files to move -> exit"
     86   finish
    9087fi
    9188
     
    9794   newrawfile=`echo $rawfile | sed -e 's/center\/fromtape\/rawdata/\/rawfiles/g' -e 's/_/\//1' -e 's/_/\//1'`
    9895   newdir=`dirname $newrawfile`
    99    makedir $newdir >> $scriptlog 2>&1
     96   makedir $newdir
    10097   
    101    mv -v $rawfile $newrawfile >> $scriptlog 2>&1
     98   mv -v $rawfile $newrawfile
    10299done
    103100
    104 rmdir -v /magic/datacenter/fromtape/rawdata/* >> $scriptlog 2>&1
     101rmdir -v /magic/datacenter/fromtape/rawdata/*
    105102
    106103printprocesslog "INFO launching filesondisk"
    107 echo "launching filesondisk" >> $scriptlog 2>&1
    108104$scriptspath/filesondisk&
    109105
    110 finish >> $scriptlog 2>&1
     106finish
    111107
  • trunk/MagicSoft/Mars/datacenter/scripts/runcamera

    r9174 r9355  
    6363
    6464
    65 scriptlog=$runlogpath/run$program-$datetime.log
    66 date >> $scriptlog 2>&1
    67 
    6865# get sequence #
    69 gettodo >> $scriptlog 2>&1
     66gettodo
    7067run=$process
    7168
    7269# lock sequ
    7370lockfile=$lockpath/lock-$table-$column-$sequence.txt
    74 checklock >> $scriptlog 2>&1
     71checklock
    7572
    76 echo "run $program for run $run..." >> $scriptlog 2>&1
    7773printprocesslog "INFO starting $program for run $run"
    7874
    79 setstatus "start" >> $scriptlog 2>&1
     75setstatus "start"
    8076
    81 echo "run $program for run $run "
    82 echo "create input card... "
     77printprocesslog "INFO create input card... "
    8378
    8479# get values for inputcard
     
    10095seeds=`sendquery`
    10196
    102 echo "" >> $scriptlog 2>&1
    103 echo "INPUTCARD:" >> $scriptlog 2>&1
    104 echo "----------" >> $scriptlog 2>&1
    105 echo "" >> $scriptlog 2>&1
    106 echo "" >> $scriptlog 2>&1
    107 printinputcard >> $scriptlog 2>&1
    108 
    10997logfile=$outpath/$program"-"`printf %06d $run`".log"
    110 makedir $outpath >> $scriptlog 2>&1
     98makedir $outpath
    11199
    112100cd $detectordir/Camera
     
    121109
    122110case $check1 in
    123    0)   echo " check1=$check1 -> everything ok " >> $scriptlog 2>&1
    124         printprocesslog "INFO $program finished successfully for sequence $sequence"
     111   0)   printprocesslog "INFO $program finished successfully for sequence $sequence (check1=$check1)"
    125112        ;;
    126    *)   echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
    127         printprocesslog "ERROR $program failed for sequence $sequence"
     113   *)   printprocesslog "ERROR $program failed for sequence $sequence (check1=$check1)"
    128114        com=$Fcamera
    129115        check=$check1
     
    131117esac
    132118
    133 setstatus "stop" >> $scriptlog 2>&1
     119setstatus "stop"
    134120
    135 finish >> $scriptlog 2>&1
     121finish
    136122
  • trunk/MagicSoft/Mars/datacenter/scripts/runcorsika

    r9347 r9355  
    111111
    112112
    113 scriptlog=$runlogpath/run$program-$datetime.log
    114 date >> $scriptlog 2>&1
    115 
    116113# get sequence #
    117 gettodo "1" >> $scriptlog 2>&1
     114gettodo "1"
    118115run=${primaries[0]}
    119116# get corsika runno
     
    125122# lock sequ
    126123lockfile=$lockpath/lock-$table-$column-$corsikarunno.txt
    127 checklock >> $scriptlog 2>&1
     124checklock
    128125
    129 echo "run $program for run $run..." >> $scriptlog 2>&1
    130126printprocesslog "INFO starting $program for run $run"
    131127
    132 setstatus "start" >> $scriptlog 2>&1
     128setstatus "start"
    133129
    134 echo "run $program for run $run " >> $scriptlog 2>&1
    135 echo "create input card... " >> $scriptlog 2>&1
     130printprocesslog "INFO run $program for run $run "
     131printprocesslog "INFO create input card... "
    136132
    137133# get values for inputcard
     
    169165diameter=`sendquery`
    170166
    171 echo "" >> $scriptlog 2>&1
    172 echo "INPUTCARD:" >> $scriptlog 2>&1
    173 echo "----------" >> $scriptlog 2>&1
    174 echo "" >> $scriptlog 2>&1
    175 echo "" >> $scriptlog 2>&1
    176 printinputcard >> $scriptlog 2>&1
    177 
    178167logfile=$outpath/$program"-"`printf %06d $corsikarunno`".log"
    179 makedir $outpath >> $scriptlog 2>&1
     168makedir $outpath
    180169
    181170cd $corsikapath
     
    192181
    193182case $check1 in
    194    0)   echo " check1=$check1 -> everything ok " >> $scriptlog 2>&1
    195         printprocesslog "INFO $program finished successfully for corsika run number $corsikarunno"
     183   0)   printprocesslog "INFO $program finished successfully for corsika run number $corsikarunno (check1=$check1)"
    196184        ;;
    197    *)   echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
    198         printprocesslog "ERROR $program failed for corsika run number $corsikarunno"
     185   *)   printprocesslog "ERROR $program failed for corsika run number $corsikarunno (check1=$check1)"
    199186        com=$Fcorsika
    200187        check=$check1
     
    202189esac
    203190
    204 setstatus "stop" >> $scriptlog 2>&1
     191setstatus "stop"
    205192
    206 finish >> $scriptlog 2>&1
     193finish
    207194
  • trunk/MagicSoft/Mars/datacenter/scripts/runreflector

    r9173 r9355  
    5959}
    6060
    61 
    62 scriptlog=$runlogpath/run$program-$datetime.log
    63 date >> $scriptlog 2>&1
    64 
    6561# get sequence #
    66 gettodo "1">> $scriptlog 2>&1
     62gettodo "1" 
    6763run=${primaries[0]}
    6864# get reflector runnumber
     
    7268# lock sequ
    7369lockfile=$lockpath/lock-$table-$column-$reflectorrunno.txt
    74 checklock >> $scriptlog 2>&1
     70checklock
    7571
    76 echo "run $program for run $run..." >> $scriptlog 2>&1
    7772printprocesslog "INFO starting $program for run $run"
    7873
    79 setstatus "start" >> $scriptlog 2>&1
     74setstatus "start"
    8075
    81 echo "run $program for run $run "
    82 echo "create input card... "
     76printprocesslog "INFO create input card... "
    8377
    8478# get values for inputcard
     
    10094infile=$mcpath"/corsika/"$date"/cer"`printf %06d \`sendquery\``
    10195
    102 echo "" >> $scriptlog 2>&1
    103 echo "INPUTCARD:" >> $scriptlog 2>&1
    104 echo "----------" >> $scriptlog 2>&1
    105 echo "" >> $scriptlog 2>&1
    106 echo "" >> $scriptlog 2>&1
    107 printinputcard >> $scriptlog 2>&1
    108 
    109 makedir $outpath >> $scriptlog 2>&1
     96makedir $outpath
    11097if ls $outfile >/dev/null 2>&1
    11198then
     
    127114
    128115case $check1 in
    129    0)   echo " check1=$check1 -> everything ok " >> $scriptlog 2>&1
    130         printprocesslog "INFO $program finished successfully for run $reflectorrunno"
     116   0)   printprocesslog "INFO $program finished successfully for run $reflectorrunno (check1=$check1)"
    131117        ;;
    132    *)   echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
    133         printprocesslog "ERROR $program failed for run $reflectorrunno"
     118   *)   printprocesslog "ERROR $program failed for run $reflectorrunno (check1=$check1)"
    134119        com=$Freflector
    135120        check=$check1
     
    137122esac
    138123
    139 setstatus "stop" >> $scriptlog 2>&1
     124setstatus "stop"
    140125
    141 finish >> $scriptlog 2>&1
     126finish
    142127
  • trunk/MagicSoft/Mars/datacenter/scripts/sourcefile

    r9221 r9355  
    6060            rm -v $lockfile
    6161         fi
    62          date
    6362         exit
    6463      fi
     
    9089      rm -v $lockfile
    9190   fi
    92    date
    9391   printprocesslog "INFO finished $0"
    9492   exit
     
    184182   checklock0=$?
    185183   case $checklock0 in
    186       0)   echo " checklock0=$checklock0 -> continue " ;;
    187       1)   echo " checklock0=$checklock0 -> file $lockfile exists"
    188            date
     184      0)   printprocesslog "INFO checklock0=$checklock0 -> continue "
     185           ;;
     186      1)   printprocesslog "WARN checklock0=$checklock0 -> file $lockfile exists"
    189187           $@
    190188           exit;;
    191       *)   echo " checklock0=$checklock0 -> something went completely wrong" ;;
     189      *)   printprocesslog "ERROR checklock0=$checklock0 -> something went completely wrong" ;;
    192190   esac
    193191}
     
    218216{
    219217   case $@ in
    220       start)   echo "setstatus start"
     218      start)   printprocesslog "INFO setstatus start"
    221219               starttime="Now()"
    222220               ;;
    223221       stop)   case $check in
    224                   ok)  echo "setstatus stop - ok"
     222                  ok)  printprocesslog "INFO setstatus stop - ok"
    225223                       statustime="Now()"
    226224                       ;;
    227                   no)  echo "setstatus stop - nothing new"
     225                  no)  printprocesslog "INFO setstatus stop - nothing new"
    228226                       check="ok"
    229227                       ;;
    230                    *)  echo "setstatus stop - failed"
     228                   *)  printprocesslog "INFO setstatus stop - failed"
    231229                       starttime=noreset
    232230                       if [ "$check" == "" ]
     
    242240               esac
    243241               ;;
    244           *)   echo "error -> exit"
    245                printprocesslog "ERROR function evalstatus got wrong variable"
     242          *)   printprocesslog "ERROR function evalstatus got wrong variable"
    246243               finish
    247244               ;;
     
    279276{
    280277   process=
    281    echo "getting todo..."
     278   printprocesslog "INFO getting todo..."
    282279   getdbsetup
    283280   getstepinfo
     
    303300      query=$query" limit 0, $@ "
    304301   fi
    305    echo " QUERY: "$query
     302   printprocesslog "INFO QUERY: "$query
    306303   if ! process=`mysql -s -u $us --password=$pw --host=$ho $db -e " $query "`
    307304   then
    308       echo "ERROR could not query processes from db -> exit"
    309305      printprocesslog "ERROR could not query processes from db (program: $program, function gettodo)"
    310306      finish
     
    313309   if [ "$process" = "" ]
    314310   then
    315       echo " => nothing to do"
     311      printprocesslog "INFO => nothing to do"
    316312      finish
    317313   else
     
    340336   query=$query" and isnull(fStartTime) and isnull(fFailedTime) and isnull(fProgramId) and isnull(fReturnCode) "
    341337   query=$query" group by $column "
    342 #   echo " QUERY: "$query
     338#   printprocesslog "INFO QUERY: "$query
    343339   if ! numproc=`mysql -s -u $us --password=$pw --host=$ho $db -e " $query "`
    344340   then
    345       echo "ERROR could not query number of todo proceses from db -> continue"
    346341      printprocesslog "ERROR could not query number of processes from db (program: $program, function getstatus)"
    347342      cont
     
    364359   if [ "$reset" = "no" ]
    365360   then
    366       echo "YOU CAN'T RESET $column for ${primaries[$s+$s]}!!!"
    367       printprocesslog "ERROR you can't reset $column for ${primaries[$s+$s]}"
     361      printprocesslog "ERROR You cannot reset $column for ${primaries[$s+$s]}"
    368362      finish
    369363   fi
     
    391385      query=$query" and ${prims[$i]}='${primaries[$s*${#prims[@]}+$i]}' "
    392386   done   
    393    echo " QUERY: "$query
     387   printprocesslog "INFO QUERY: "$query
    394388   if ! mysql -s -u $us --password=$pw --host=$ho $db -e " $query "
    395389   then
    396       echo "ERROR could not insert status into db -> exit"
    397390      printprocesslog "ERROR could not set status in db (program: $program, function setstatus)"
    398391      finish
  • trunk/MagicSoft/Mars/datacenter/scripts/writedatasetfiles

    r9113 r9355  
    4141column=fDataSetFileWritten
    4242
    43 scriptlog=$runlogpath/$program-$datetime.log
    44 date >> $scriptlog 2>&1
    45 
    4643# check if script is already running
    4744lockfile=$lockpath/lock-$program.txt
    48 checklock  >> $scriptlog 2>&1
     45checklock
    4946
    5047# get todo list
    51 gettodo  >> $scriptlog 2>&1
     48gettodo
    5249
    5350cd $mars
     
    5653do
    5754   dataset=${primaries[$s]}
    58    echo "writing dataset file for dataset $dataset..." >> $scriptlog 2>&1
    5955   printprocesslog "INFO writing datasetfile for dataset $dataset"
    6056   no=`printf %08d $dataset | cut -c 0-5`
    6157   no2=`printf %08d $dataset`
    6258   datasetpathcpl=$datasetpath/$no
    63    makedir $datasetpathcpl >> $scriptlog 2>&1
     59   makedir $datasetpathcpl
    6460   writedatasetfilelogpath=$logpath/$program/$no
    65    makedir $writedatasetfilelogpath >> $scriptlog 2>&1
     61   makedir $writedatasetfilelogpath
    6662   logfile=$writedatasetfilelogpath/$program-$no2.log
    6763
    68    setstatus "start" >> $scriptlog 2>&1
     64   setstatus "start"
    6965   
    7066   check1=`root -q -b $macrospath/writedatasetfile.C+\($dataset\,\""$datasetpathcpl\""\) | tee $logfile | intgrep`
    7167
    7268   case $check1 in
    73       1)   echo " check1=$check1 -> everything ok" >> $scriptlog 2>&1
    74            printprocesslog "INFO wrote datasetfile for dataset $dataset successfully"
     69      1)   printprocesslog "INFO wrote datasetfile for dataset $dataset successfully (check1=$check1)"
    7570           ;;
    76       0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1
    77            printprocesslog "WARN connection to DB failed"
     71      0)   printprocesslog "WARN connection to DB failed (check1=$check1)"
    7872           check="no"
    7973           ;;
    80       *)   echo " check1=$check1 -> ERROR " >> $scriptlog 2>&1
    81            printprocesslog "ERROR writedatasetfile.C failed"
     74      *)   printprocesslog "ERROR writedatasetfile.C failed (check1=$check1)"
    8275           com=$Fwritedatasetfile
    8376           check=$check1
     
    8578   esac
    8679   
    87    setstatus "stop" >> $scriptlog 2>&1
     80   setstatus "stop"
    8881done
    8982
    90 finish >> $scriptlog 2>&1
     83finish
    9184
  • trunk/MagicSoft/Mars/datacenter/scripts/writesequencefiles

    r9054 r9355  
    4242set -C
    4343
    44 scriptlog=$runlogpath/$program-$datetime.log
    45 date >> $scriptlog 2>&1
    46 
    4744# check if script is already running
    4845lockfile=$lockpath/lock-$program.txt
    49 checklock  >> $scriptlog 2>&1
     46checklock
    5047
    5148# get todo list
    52 gettodo  >> $scriptlog 2>&1
     49gettodo
    5350
    5451cd $mars
     
    6360   no2=`printf %08d $sequence`
    6461   sequencepath=$sequpath/$no
    65    makedir $sequencepath >> $scriptlog 2>&1
     62   makedir $sequencepath
    6663
    6764   writesequencefilelogpath=$logpath/$program/$no
    68    makedir $writesequencefilelogpath >> $scriptlog 2>&1
     65   makedir $writesequencefilelogpath
    6966   writesequencefilelog=$writesequencefilelogpath/writesequencefile-$no2.log
    7067
    71    echo "write sequencefile for sequence $sequence" >> $scriptlog 2>&1
    72    setstatus "start" >> $scriptlog 2>&1
     68   setstatus "start"
    7369
    74    check2=`root -q -b $macrospath/writesequencefile.C\($sequence\,$telnum\,"\"$sequpath\""\) | tee $writesequencefilelog | intgrep`
    75    case $check2 in
    76       1)   echo " check2=$check2 -> everything ok " >> $scriptlog 2>&1
    77            printprocesslog "INFO sequence file successfully written for sequence $sequence"
     70   check1=`root -q -b $macrospath/writesequencefile.C\($sequence\,$telnum\,"\"$sequpath\""\) | tee $writesequencefilelog | intgrep`
     71   case $check1 in
     72      1)   printprocesslog "INFO sequence file successfully written for sequence $sequence (check1=$check1)"
    7873           ;;
    79       0)   echo " check2=$check2 -> no connection to db -> continue..." >> $scriptlog 2>&1
    80            printprocesslog "WARN connection to DB failed"
     74      0)   printprocesslog "WARN connection to DB failed (check1=$check1)"
    8175           check="no"
    8276           ;;
    83       *)   echo " check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
    84            printprocesslog "ERROR $program.C failed for sequence $sequence"
     77      *)   printprocesslog "ERROR $program.C failed for sequence $sequence (check1=$check1)"
    8578           com=$Fwritesequfile
    86            check=$check2
     79           check=$check1
    8780           ;;
    8881   esac
    8982   
    90    setstatus "stop" >> $scriptlog 2>&1
     83   setstatus "stop"
    9184done
    9285
    93 finish >> $scriptlog 2>&1
     86finish
    9487
Note: See TracChangeset for help on using the changeset viewer.