Ignore:
Timestamp:
05/07/13 23:22:58 (12 years ago)
Author:
Daniela Dorner
Message:
added pv to control rate of zipping, limited pigz to 2 processes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataCheck/Transfer/ZipRawData.sh

    r14840 r15517  
    1515   finish
    1616fi
    17 # get last 3, 6 or 9 nights
    18 dates=( `date +%Y/%m/%d --date="-12hour"` `date +%Y/%m/%d --date="-36hour"` `date +%Y/%m/%d --date="-60hour"` \
    19 #        `date +%Y/%m/%d --date="-84hour"` `date +%Y/%m/%d --date="-108hour"` `date +%Y/%m/%d --date="-132hour"` \
    20 #        `date +%Y/%m/%d --date="-156hour"` `date +%Y/%m/%d --date="-180hour"` `date +%Y/%m/%d --date="-204hour"` \
    21        )
    22 
    23 # get last 3, 6 or 9 nights
    24 dates=(
    25         `date +%Y/%m/%d --date="-204hour"`  `date +%Y/%m/%d --date="-180hour"` `date +%Y/%m/%d --date="-156hour"` \
    26         `date +%Y/%m/%d --date="-132hour"`  `date +%Y/%m/%d --date="-108hour"` `date +%Y/%m/%d --date="-84hour"` \
    27         `date +%Y/%m/%d --date="-60hour"`   `date +%Y/%m/%d --date="-36hour"`  `date +%Y/%m/%d --date="-12hour"`  \
    28         )
     17# get current hour
     18hour=`date +%k`
     19if [ $hour -le 7 ] || [ $hour -ge 19 ]
     20then
     21   dates=( `date +%Y/%m/%d --date="-12hour"` )
     22else
     23   # get last 3, 6 or 9 nights
     24   dates=( `date +%Y/%m/%d --date="-12hour"` `date +%Y/%m/%d --date="-36hour"` `date +%Y/%m/%d --date="-60hour"` \
     25   #        `date +%Y/%m/%d --date="-84hour"` `date +%Y/%m/%d --date="-108hour"` `date +%Y/%m/%d --date="-132hour"` \
     26   #        `date +%Y/%m/%d --date="-156hour"` `date +%Y/%m/%d --date="-180hour"` `date +%Y/%m/%d --date="-204hour"` \
     27           )
     28fi
    2929
    3030# setup to use ftools
     
    128128      printprocesslog "INFO zipping "$file" to "$zipfile" ..."
    129129      #echo "INFO zipping "$file" to "$zipfile" ..."
     130      source `dirname $0`/../Sourcefile.sh
    130131      # zip file to stdout and pipe it to outputfile
    131       if pigz -1 -c -f $file > $zipfiletmp
     132      echo "pv --rate-limit $limitpigz $file | pigz -1 -c -f -p 2 > $zipfiletmp" >> $logfile 2>&1
     133      pv --rate-limit $limitpigz $file | pigz -1 -c -f -p 2 > $zipfiletmp
     134      statuspigz=( `echo ${PIPESTATUS[@]}` )
     135      printprocesslog "DEBUG PIPESTATUS:"${statuspigz[@]}
     136      echo " PIPESTATUS:"${statuspigz[@]} >> $logfile 2>&1
     137      if [ ${statuspigz[0]} -eq 0 ] && [ ${statuspigz[1]} -eq 0 ]
    132138      then
    133139         # if successful, move temporary to final zipfile
     
    136142      else
    137143         # if not successful, remove temporary zipfile
     144         printprocesslog "WARN pigz or pv failed (PIPESTATUS:"${statuspigz[@]}")."
     145         echo "WARN pigz or pv failed (PIPESTATUS:"${statuspigz[@]}")." >> $logfile 2>&1
     146         finish
    138147         printprocesslog "INFO remove "$zipfiletmp"..."
    139148         rm -v $zipfiletmp >> $logfile 2>&1
     
    142151         if [ ${diskusage[3]} -lt 10000000 ]
    143152         then
    144             echo "WARN less than 10 GB left on /loc_data on data "
     153            echo "WARN less than 10 GB left on /loc_data on data " >> $logfile 2>&1
    145154            printprocesslog "WARN less than 10 GB left on /loc_data on data "
    146155            finish
Note: See TracChangeset for help on using the changeset viewer.