source: trunk/DataCheck/Transfer/RsyncAuxLP.sh@ 14788

Last change on this file since 14788 was 13599, checked in by Daniela Dorner, 12 years ago
changed time range for rsync of aux files from 3 to 9 days
  • Property svn:executable set to *
File size: 3.0 KB
Line 
1#!/bin/bash
2
3# this script has been written to run on La Palma on the machine data
4# i.e. paths are only working on this machine
5
6source `dirname $0`/../Sourcefile.sh
7printprocesslog "INFO starting "$0
8
9logfile=$runlogpath"/RsyncAuxLP-"$datetime".log"
10date >> $logfile
11
12# check if /daq is mounted on data
13if ! mount | grep daq >> $logfile 2>&1
14then
15 printprocesslog "ERROR /daq is not mounted on data => please mount it"
16 echo `date`": /daq is not mounted on data => please mount it"
17 finish
18fi
19
20# check if paths are available
21if ! ls /daq/aux >/dev/null 2>&1
22then
23 printprocesslog "ERROR /daq/aux is not available."
24 finish
25fi
26if ! ls /loc_data/aux >/dev/null 2>&1
27then
28 printprocesslog "ERROR /loc_data/aux is not available."
29 finish
30fi
31
32
33# get last 3, 6 or 9 nights
34dates=( `date +%Y/%m/%d --date="-12hour"` `date +%Y/%m/%d --date="-36hour"` `date +%Y/%m/%d --date="-60hour"` \
35 `date +%Y/%m/%d --date="-84hour"` `date +%Y/%m/%d --date="-108hour"` `date +%Y/%m/%d --date="-132hour"` \
36 `date +%Y/%m/%d --date="-156hour"` `date +%Y/%m/%d --date="-180hour"` `date +%Y/%m/%d --date="-204hour"` \
37 )
38
39# do rsync for rawfiles of these dates
40for date in ${dates[@]}
41do
42 echo "" >> $logfile 2>&1
43 # auxiliary data directories on data
44 auxdirdaq=/daq/aux/$date/ # /loc_data from daq via nfs on data
45 if ! [ -d $auxdirdaq ]
46 then
47 auxdirdata=/loc_data/aux/$date/
48 if ! [ -d $auxdirdata ]
49 then
50 printprocesslog "INFO "$auxdirdaq" and "$auxdirdata" not found. " >> $logfile 2>&1
51 else
52 printprocesslog "WARN "$auxdirdaq" not found, but "$auxdirdata". Data were probably taken on data." >> $logfile 2>&1
53 fi
54 echo `date`": "$auxdirdaq" not found. " >> $logfile 2>&1
55 continue
56 fi
57 auxdirdata=/loc_data/aux/$date
58 if ! [ -d $auxdirdata ]
59 then
60 mkdir -pv $auxdirdata >> $logfile 2>&1
61 fi
62 printprocesslog "INFO processing files in "$auxdirdaq >> $logfile 2>&1
63 echo `date`": processing files in "$auxdirdaq >> $logfile 2>&1
64
65 # get current hour
66 hour=`date +%k`
67 # define bwlimit for rsync depending on the time: from 19-7h reduced bwlimit for rsync
68 if [ $hour -le 6 ] || [ $hour -ge 19 ]
69 then
70 # limit bw for rsync to 20 MB/s during night
71 bwlimit="--bwlimit=20000"
72 printprocesslog "INFO rsync data with "$bwlimit >> $logfile 2>&1
73 echo "rsync data with "$bwlimit >> $logfile 2>&1
74 else
75 # no bw limit during day
76 printprocesslog "INFO rsync data without bwlimit" >> $logfile 2>&1
77 echo "rsync data without bwlimit" >> $logfile 2>&1
78 fi
79
80 #rsync from daq to data
81 #if ! /usr/bin/rsync -avxHPu $bwlimit $auxdirdaq $auxdirdata >> $logfile 2>&1 # in case of adding checksum, only update files with rsync
82 if ! /usr/bin/rsync -avxHP -T $rsynctempdir $bwlimit $auxdirdaq $auxdirdata >> $logfile 2>&1
83 then
84 printprocesslog "WARN problem rsyncing auxiliary data for "$date" from daq to data"
85 echo `date`": problem rsyncing auxiliary data for "$date" from daq to data"
86 fi
87done
88
Note: See TracBrowser for help on using the repository browser.