Ignore:
Timestamp:
11/21/11 06:56:22 (13 years ago)
Author:
Daniela Dorner
Message:
changed to take into account the current and the 3 previous nights
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataCheck/RsyncAux.sh

    r12576 r12582  
    11#!/bin/bash
    2 
    3 date=`date +%Y/%m/%d --date="-1day"`
    42
    53today=`date +%F`
    64logfile=/home/`whoami`/DataCheck/log/RsyncAux$today.log
    75
    8 echo "" >> $logfile 2>&1
    9 echo "" >> $logfile 2>&1
    10 echo "" >> $logfile 2>&1
    11 # auxiliary data directories on data
    12 auxdirdaq=/daq/aux/$date/ # /loc_data from daq via nfs on data
    13 auxdirdata=/loc_data/aux/$date
    14 echo `date`": processing files in "$auxdir >> $logfile 2>&1
     6# get last 3 nights
     7dates=( `date +%Y/%m/%d` `date +%Y/%m/%d --date="-1day"` `date +%Y/%m/%d --date="-2day"` `date +%Y/%m/%d --date="-3day"` )
    158
    16 # get current hour
    17 hour=`date +%k`
    18 # define bwlimit for rsync depending on the time
    19 if [ $hour -lt 8 ] || [ $hour -gt 18 ]
    20 then
    21    # limit bw for rsync to 20 MB/s during night
    22    bwlimit="--bwlimit=20000"
    23    echo "rsync data with "$bwlimit >> $logfile 2>&1
    24 else
    25    # no bw limit during day
    26    echo "rsync data without bwlimit" >> $logfile 2>&1
    27 fi
     9# do rsync for rawfiles of these dates
     10for date in ${dates[@]}
     11do
     12   echo "" >> $logfile 2>&1
     13   echo "" >> $logfile 2>&1
     14   echo "" >> $logfile 2>&1
     15   # auxiliary data directories on data
     16   auxdirdaq=/daq/aux/$date/ # /loc_data from daq via nfs on data
     17   if ! [ -d $auxdirdaq ]
     18   then
     19      echo `date`": "$auxdirdaq" not found. Data were probably taken on data" >> $logfile 2>&1
     20      continue
     21   fi
     22   auxdirdata=/loc_data/aux/$date
     23   echo `date`": processing files in "$auxdirdaq >> $logfile 2>&1
     24   
     25   # get current hour
     26   hour=`date +%k`
     27   # define bwlimit for rsync depending on the time
     28   if [ $hour -lt 8 ] || [ $hour -gt 18 ]
     29   then
     30      # limit bw for rsync to 20 MB/s during night
     31      bwlimit="--bwlimit=20000"
     32      echo "rsync data with "$bwlimit >> $logfile 2>&1
     33   else
     34      # no bw limit during day
     35      echo "rsync data without bwlimit" >> $logfile 2>&1
     36   fi
     37   
     38   #rsync from daq to data
     39   if ! /usr/bin/rsync -avxHP $bwlimit $auxdirdaq $auxdirdata >> $logfile 2>&1
     40   then
     41      echo `date`": problem rsyncing auxiliary data from daq to data"
     42   fi
     43done
    2844
    29 #rsync from daq to data
    30 if ! /usr/bin/rsync -avxHP $bwlimit $auxdirdaq $auxdirdata >> $logfile 2>&1
    31 then
    32    echo `date`": problem rsyncing auxiliary data from daq to data"
    33 fi
    34 
    35 
Note: See TracChangeset for help on using the changeset viewer.