Last change
on this file since 12613 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 |
|
---|
3 | today=`date +%F`
|
---|
4 | logfile=/home/`whoami`/DataCheck/log/RsyncRaw$today.log
|
---|
5 |
|
---|
6 | # get last 3 nights
|
---|
7 | dates=( `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
|
---|
10 | for date in ${dates[@]}
|
---|
11 | do
|
---|
12 | echo "" >> $logfile 2>&1
|
---|
13 | echo "" >> $logfile 2>&1
|
---|
14 | echo "" >> $logfile 2>&1
|
---|
15 | # raw data directories on data
|
---|
16 | rawdirdaq=/daq/raw/$date/ # /loc_data from daq via nfs on data
|
---|
17 | if ! [ -d $rawdirdaq ]
|
---|
18 | then
|
---|
19 | echo `date`": "$rawdirdaq" not found. Data were probably taken on data" >> $logfile 2>&1
|
---|
20 | continue
|
---|
21 | fi
|
---|
22 | rawdirdata=/loc_data/raw/$date
|
---|
23 | echo `date`": processing files in "$rawdirdaq >> $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 $rawdirdaq $rawdirdata >> $logfile 2>&1
|
---|
40 | then
|
---|
41 | echo `date`": problem rsyncing rawdata from daq to data"
|
---|
42 | fi
|
---|
43 | done
|
---|
44 |
|
---|
45 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.