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