Last change
on this file since 12730 was 12676, checked in by Daniela Dorner, 13 years ago |
small fix to create new directories
|
-
Property svn:executable
set to
*
|
File size:
1.5 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 -avxHP $bwlimit $rawdirdaq $rawdirdata >> $logfile 2>&1
|
---|
53 | then
|
---|
54 | echo `date`": problem rsyncing rawdata for "$date" from daq to data"
|
---|
55 | fi
|
---|
56 | done
|
---|
57 |
|
---|
58 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.