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