source: trunk/DataCheck/RsyncAux.sh@ 12586

Last change on this file since 12586 was 12582, checked in by Daniela Dorner, 13 years ago
changed to take into account the current and the 3 previous nights
  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#!/bin/bash
2
3today=`date +%F`
4logfile=/home/`whoami`/DataCheck/log/RsyncAux$today.log
5
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"` )
8
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
44
Note: See TracBrowser for help on using the repository browser.