Last change
on this file since 12788 was 12762, checked in by Daniela Dorner, 13 years ago |
adapted rsync options for running ftchecksum on data, but still commented
|
-
Property svn:executable
set to
*
|
File size:
1.7 KB
|
Line | |
---|
1 | #!/bin/bash
|
---|
2 |
|
---|
3 | today=`date +%F`
|
---|
4 | logfile=/home/`whoami`/DataCheck/log/RsyncRaw$today.log
|
---|
5 |
|
---|
6 | echo "" >> $logfile 2>&1
|
---|
7 | echo "" >> $logfile 2>&1
|
---|
8 | echo "" >> $logfile 2>&1
|
---|
9 |
|
---|
10 | # check if /daq is mounted on data
|
---|
11 | if ! mount | grep daq >> $logfile 2>&1
|
---|
12 | then
|
---|
13 | echo "/daq is not mounted on data => please mount it"
|
---|
14 | exit
|
---|
15 | fi
|
---|
16 |
|
---|
17 | # get last 3 nights
|
---|
18 | dates=( `date +%Y/%m/%d` `date +%Y/%m/%d --date="-1day"` `date +%Y/%m/%d --date="-2day"` `date +%Y/%m/%d --date="-3day"` )
|
---|
19 |
|
---|
20 | # do rsync for rawfiles of these dates
|
---|
21 | for date in ${dates[@]}
|
---|
22 | do
|
---|
23 | echo "" >> $logfile 2>&1
|
---|
24 | # raw data directories on data
|
---|
25 | rawdirdaq=/daq/raw/$date/ # /loc_data from daq via nfs on data
|
---|
26 | if ! [ -d $rawdirdaq ]
|
---|
27 | then
|
---|
28 | echo `date`": "$rawdirdaq" not found. Data were probably taken on data" >> $logfile 2>&1
|
---|
29 | continue
|
---|
30 | fi
|
---|
31 | rawdirdata=/loc_data/raw/$date
|
---|
32 | if ! [ -d $rawdirdata ]
|
---|
33 | then
|
---|
34 | mkdir -pv $rawdirdata >> $logfile 2>&1
|
---|
35 | fi
|
---|
36 | echo `date`": processing files in "$rawdirdaq >> $logfile 2>&1
|
---|
37 |
|
---|
38 | # get current hour
|
---|
39 | hour=`date +%k`
|
---|
40 | # define bwlimit for rsync depending on the time
|
---|
41 | if [ $hour -lt 8 ] || [ $hour -gt 18 ]
|
---|
42 | then
|
---|
43 | # limit bw for rsync to 20 MB/s during night
|
---|
44 | bwlimit="--bwlimit=20000"
|
---|
45 | echo "rsync data with "$bwlimit >> $logfile 2>&1
|
---|
46 | else
|
---|
47 | # no bw limit during day
|
---|
48 | echo "rsync data without bwlimit" >> $logfile 2>&1
|
---|
49 | fi
|
---|
50 |
|
---|
51 | #rsync from daq to data
|
---|
52 | #if ! /usr/bin/rsync -avxHPu $bwlimit $rawdirdaq $rawdirdata >> $logfile 2>&1 # in case of adding checksum, only update files with rsync
|
---|
53 | if ! /usr/bin/rsync -avxHP $bwlimit $rawdirdaq $rawdirdata >> $logfile 2>&1
|
---|
54 | then
|
---|
55 | echo `date`": problem rsyncing rawdata for "$date" from daq to data"
|
---|
56 | fi
|
---|
57 | done
|
---|
58 |
|
---|
59 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.