source: trunk/DataCheck/RsyncAux.sh@ 12653

Last change on this file since 12653 was 12633, checked in by Daniela Dorner, 13 years ago
added check if /daq is mounted
  • Property svn:executable set to *
File size: 1.5 KB
Line 
1#!/bin/bash
2
3today=`date +%F`
4logfile=/home/`whoami`/DataCheck/log/RsyncAux$today.log
5
6echo "" >> $logfile 2>&1
7echo "" >> $logfile 2>&1
8echo "" >> $logfile 2>&1
9
10# check if /daq is mounted on data
11if ! mount | grep daq >> $logfile 2>&1
12then
13 echo "/daq is not mounted on data => please mount it"
14 exit
15fi
16
17# get last 3 nights
18dates=( `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
21for date in ${dates[@]}
22do
23 echo "" >> $logfile 2>&1
24 # auxiliary data directories on data
25 auxdirdaq=/daq/aux/$date/ # /loc_data from daq via nfs on data
26 if ! [ -d $auxdirdaq ]
27 then
28 echo `date`": "$auxdirdaq" not found. Data were probably taken on data" >> $logfile 2>&1
29 continue
30 fi
31 auxdirdata=/loc_data/aux/$date
32 echo `date`": processing files in "$auxdirdaq >> $logfile 2>&1
33
34 # get current hour
35 hour=`date +%k`
36 # define bwlimit for rsync depending on the time
37 if [ $hour -lt 8 ] || [ $hour -gt 18 ]
38 then
39 # limit bw for rsync to 20 MB/s during night
40 bwlimit="--bwlimit=20000"
41 echo "rsync data with "$bwlimit >> $logfile 2>&1
42 else
43 # no bw limit during day
44 echo "rsync data without bwlimit" >> $logfile 2>&1
45 fi
46
47 #rsync from daq to data
48 if ! /usr/bin/rsync -avxHP $bwlimit $auxdirdaq $auxdirdata >> $logfile 2>&1
49 then
50 echo `date`": problem rsyncing auxiliary data for "$date" from daq to data"
51 fi
52done
53
Note: See TracBrowser for help on using the repository browser.