Changeset 17077


Ignore:
Timestamp:
09/05/13 14:13:18 (11 years ago)
Author:
Daniela Dorner
Message:
added new function getdates to get the path for the wished nights (certain night, last x nights, all nights)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataCheck/Sourcefile.sh

    r15600 r17077  
    472472}
    473473
    474 
     474function getdates()
     475{
     476   case $1 in
     477      # all dates
     478      all)
     479         printprocesslog "DEBUG getdates case 'all'"
     480         dates=( `find -L $ziprawdata -mindepth 3 -type d | sort -r | sed "s/\${ziprawdata_for_sed}//g" | sed -e 's/^\///'` ) #all available dates in /loc_data/zipraw
     481         ;;
     482      # certain date
     483      [0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9])
     484         printprocesslog "DEBUG getdates case certain date: "$1
     485         dates=( $1 )
     486         ;;
     487      # certain number of dates (between 0 and 99 )
     488      [0-9][0-9]|[0-9])
     489         # get last n nights
     490         for (( numdates=1 ; numdates <= $1 ; numdates++ ))
     491         do
     492            numhours=`echo " 12 + ( $numdates - 1 ) * 24 " | bc -l`
     493            dates=( ${dates[@]} `date +%Y/%m/%d --date="-"$numhours"hour"` )
     494         done
     495         # hour-dependent number of dates
     496         if [ "$2" != "" ] && [ "$3" != "" ]
     497         then
     498            # get current hour
     499            hour=`date +%k`
     500            if [ $hour -le $3 ] || [ $hour -ge $2 ]
     501            then
     502               dates=( `date +%Y/%m/%d --date="-12hour"` )
     503            fi
     504         fi
     505         ;;
     506      *) # nothing valid given
     507         echo "Please give valid options for the function 'getdates()'"
     508         finish
     509         ;;
     510   esac
     511}
     512
Note: See TracChangeset for help on using the changeset viewer.