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 |
|
---|
6 | source `dirname $0`/../Sourcefile.sh
|
---|
7 | printprocesslog "INFO starting "$0
|
---|
8 |
|
---|
9 | logfile=$runlogpath"/RsyncAuxToISDC-"$datetime".log"
|
---|
10 | date >> $logfile
|
---|
11 |
|
---|
12 | # get last 3 nights
|
---|
13 | dates=( `date +%Y/%m/%d --date="-12hour"` `date +%Y/%m/%d --date="-36hour"` `date +%Y/%m/%d --date="-60hour"` )
|
---|
14 |
|
---|
15 | # do rsync for rawfiles of these dates
|
---|
16 | for date in ${dates[@]}
|
---|
17 | do
|
---|
18 | echo "" >> $logfile 2>&1
|
---|
19 | echo $date >> $logfile 2>&1
|
---|
20 | # auxiliary data directories
|
---|
21 | auxdirlp=/loc_data/aux/./$date/
|
---|
22 | auxdirisdc=/scratch/from_lapalma/aux
|
---|
23 |
|
---|
24 | printprocesslog "INFO processing files in "$auxdirlp >> $logfile 2>&1
|
---|
25 | echo `date`": processing files in "$auxdirlp >> $logfile 2>&1
|
---|
26 |
|
---|
27 | # get current hour
|
---|
28 | hour=`date +%k`
|
---|
29 | # define bwlimit for rsync depending on the time: from 19-7h reduced bwlimit for rsync
|
---|
30 | if [ $hour -le 14 ] || [ $hour -ge 13 ]
|
---|
31 | then
|
---|
32 | # use once a day the -c option
|
---|
33 | # normally files are compared by size and time
|
---|
34 | # but for the daily files the size doesn't change when TSTOP is added
|
---|
35 | # due to the one hour time difference it could happen that rsync
|
---|
36 | # doesn't update the file when only checking time and size
|
---|
37 | # run with this option after lunch (LP time)
|
---|
38 | option="-c"
|
---|
39 | printprocesslog "INFO rsync data with option "$option >> $logfile 2>&1
|
---|
40 | echo "rsync data with option "$option >> $logfile 2>&1
|
---|
41 | else
|
---|
42 | # no extra option
|
---|
43 | printprocesslog "INFO rsync data without extra option" >> $logfile 2>&1
|
---|
44 | echo "rsync data without extra option" >> $logfile 2>&1
|
---|
45 | fi
|
---|
46 |
|
---|
47 | #rsync from daq to data
|
---|
48 | #if ! /usr/bin/rsync -avxHPu $bwlimit $auxdirdaq $auxdirdata >> $logfile 2>&1 # in case of adding checksum, only update files with rsync
|
---|
49 | if ! rsync -rltDvR -T $rsynctempdir --stats fact@161.72.93.131:$auxdirlp $auxdirisdc >> $logfile 2>&1
|
---|
50 | then
|
---|
51 | printprocesslog "WARN problem rsyncing auxiliary data for "$date" from La Palma to ISDC"
|
---|
52 | echo `date`": problem rsyncing auxiliary data for "$date" from La Palma to ISDC" >> $logfile 2>&1
|
---|
53 | echo `date`": problem rsyncing auxiliary data for "$date" from La Palma to ISDC"
|
---|
54 | fi
|
---|
55 | done
|
---|
56 |
|
---|