Changeset 17094


Ignore:
Timestamp:
09/06/13 15:56:36 (11 years ago)
Author:
Daniela Dorner
Message:
usage of getdates function, prepared script to be used in RunMoreNights.sh, cleanup
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataCheck/Processing/FillMoonInfo.sh

    r15220 r17094  
    11#!/bin/bash
    22
    3 # option
    4 doupdate="yes" # update all entries (needed when new fields have been added)
    5 doupdate="no" # fill only entries which are not yet existing (default)
     3# script to fill moon information to DB
     4# doesn't need raw files
     5# probably doesn't run at ISDC (FACT++/moon missing)
     6
     7# option whether to fill all row or only those where information is missing
     8# $doupdate might be given as environment variable
     9if [ "$doupdate" = "" ]
     10then
     11   doupdate="yes" # update all entries (needed when new fields have been added)
     12   doupdate="no" # fill only entries which are not yet existing (default)
     13fi
    614
    715source `dirname $0`/../Sourcefile.sh
    816printprocesslog "INFO starting $0 with option doupdate="$doupdate
    917
    10 #logfile=$runlogpath"/FillMoonInfo-"$datetime".log"
    11 #date >> $logfile
    12 
    13 # get last 3, 6 or 9 nights
    14 dates=( `date +%Y/%m/%d --date="-12hour"` `date +%Y/%m/%d --date="-36hour"` `date +%Y/%m/%d --date="-60hour"` \
    15         `date +%Y/%m/%d --date="-84hour"` `date +%Y/%m/%d --date="-108hour"` `date +%Y/%m/%d --date="-132hour"` \
    16 #        `date +%Y/%m/%d --date="-156hour"` `date +%Y/%m/%d --date="-180hour"` `date +%Y/%m/%d --date="-204hour"` \
    17         )
    18 
    19 #dates=( `date +%Y/%m/%d --date="-228hour"` `date +%Y/%m/%d --date="-252hour"` `date +%Y/%m/%d --date="-276hour"` )
    20 
    21 #dates=( `find $auxdata -mindepth 3 -type d | sort -r | sed "s/\${auxdata_for_sed}//g" | sed -e 's/^\///'` )
     18# get dates
     19if [ "$certaindate" != "" ]
     20then
     21   getdates $certaindate
     22else
     23   # get all night
     24   #getdates "all"
     25   # get last 6 nights
     26   getdates 6
     27fi
    2228
    2329printprocesslog "INFO processing the following night(s): "${dates[@]}
    24 #echo  `date`": processing the following night(s): "${dates[@]} #>> $logfile 2>&1
    2530
    2631# do filling of aux data
     
    3742   # get file numbers from DB
    3843   #   but only for not-corrupted files
    39    #query="SELECT fRunID from RunInfo WHERE fNight="$runnumber" AND NOT ISNULL(fRightAscension) AND NOT ISNULL(fDeclination) "
    4044   query="SELECT fRunID from RunInfo WHERE fNight="$runnumber" AND NOT ISNULL(fRunStart) "
    41    #query=$query" AND fRunTypeKEY=6 "
    4245   if [ "$doupdate" = "no" ]
    4346   then
     
    5659   do
    5760      printprocesslog "INFO processing file number "$runnumber"_"`printf %03d $filenum`
    58       #echo  `date`": processing file number "$runnumber"_"`printf %03d $filenum` # >> $logfile 2>&1
    5961     
    6062      # get input info from DB
     
    6567      query=$query" WHERE fNight="$runnumber" AND fRunID="$filenum
    6668      info=( `sendquery` )
    67       #echo ${info[@]}
    68       #echo "/home/fact/FACT++.db/moon "${info[2]} ${info[3]}" --ra=${info[0]} --dec=${info[1]} 2>/dev/null"
    6969      if [ "${info[0]}" == "999" ] && [ "${info[1]}" == "999" ]
    7070      then
     
    7575      # return values of the programm
    7676      # timestamp sunzd moon-visible moondisk moonzd angletomoon angletosun
    77       #echo ${lightinfo[@]}
    7877     
    7978      # build query to update runinfo in DB
     
    8786      # add where condition
    8887      query=$query" WHERE fNight="$runnumber" AND fRunID="$filenum
     88
    8989      #echo $query
    9090      # send query to DB
Note: See TracChangeset for help on using the changeset viewer.