Changeset 18422


Ignore:
Timestamp:
01/27/16 21:50:21 (9 years ago)
Author:
Daniela Dorner
Message:
added option to function getdate to get the next up to 9 nights
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataCheck/Sourcefile.sh

    r18323 r18422  
    521521         fi
    522522         ;;
     523      # certain number of dates in the future (between 0 and 9)
     524      +[1-9])
     525         # get next n nights
     526         printprocesslog "DEBUG getdates - get the next "$1" days."
     527         for (( numdates=1 ; numdates <= $1 ; numdates++ ))
     528         do
     529            numhours=`echo " 12 + ( $numdates - 1 ) * 24 " | bc -l`
     530            dates=( ${dates[@]} `date +%Y/%m/%d --date="+"$numhours"hour"` )
     531         done
     532         # hour-dependent number of dates
     533         if [ "$2" != "" ] && [ "$3" != "" ]
     534         then
     535            # get current hour
     536            hour=`date +%k`
     537            if [ $hour -le $2 ] || [ $hour -ge $3 ]
     538            then
     539               printprocesslog "DEBUG getdates - get the current night."
     540               dates=( `date +%Y/%m/%d --date="-12hour"` )
     541            fi
     542         fi
     543         ;;
    523544      *) # nothing valid given
    524          echo "Please give valid option (YYYY/MM/DD[-RRR] or 1-9999)"
     545         echo "Please give valid option (YYYY/MM/DD[-RRR] or 1-9999 or +0-9)"
    525546         finish
    526547         ;;
Note: See TracChangeset for help on using the changeset viewer.