source: trunk/DataCheck/Transfer/RsyncAuxToISDC.sh@ 13845

Last change on this file since 13845 was 13599, checked in by Daniela Dorner, 13 years ago
changed time range for rsync of aux files from 3 to 9 days
  • Property svn:executable set to *
File size: 2.6 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"/RsyncAuxToISDC-"$datetime".log"
10date >> $logfile
11
12# get last 3, 6 or 9 nights
13dates=( `date +%Y/%m/%d --date="-12hour"` `date +%Y/%m/%d --date="-36hour"` `date +%Y/%m/%d --date="-60hour"` \
14 `date +%Y/%m/%d --date="-84hour"` `date +%Y/%m/%d --date="-108hour"` `date +%Y/%m/%d --date="-132hour"` \
15 `date +%Y/%m/%d --date="-156hour"` `date +%Y/%m/%d --date="-180hour"` `date +%Y/%m/%d --date="-204hour"` \
16 )
17
18# do rsync for rawfiles of these dates
19for date in ${dates[@]}
20do
21 echo "" >> $logfile 2>&1
22 echo $date >> $logfile 2>&1
23 # auxiliary data directories
24 auxdirlp=/loc_data/aux/./$date/
25 auxdirisdc=/scratch/from_lapalma/aux
26
27 printprocesslog "INFO processing files in "$auxdirlp >> $logfile 2>&1
28 echo `date`": processing files in "$auxdirlp >> $logfile 2>&1
29
30 # get current hour
31 hour=`date +%k`
32 # define bwlimit for rsync depending on the time: from 19-7h reduced bwlimit for rsync
33 if [ $hour -le 14 ] || [ $hour -ge 13 ]
34 then
35 # use once a day the -c option
36 # normally files are compared by size and time
37 # but for the daily files the size doesn't change when TSTOP is added
38 # due to the one hour time difference it could happen that rsync
39 # doesn't update the file when only checking time and size
40 # run with this option after lunch (LP time)
41 option="-c"
42 printprocesslog "INFO rsync data with option "$option >> $logfile 2>&1
43 echo "rsync data with option "$option >> $logfile 2>&1
44 else
45 # no extra option
46 printprocesslog "INFO rsync data without extra option" >> $logfile 2>&1
47 echo "rsync data without extra option" >> $logfile 2>&1
48 fi
49
50 if ! ssh fact@161.72.93.131 "ls $auxdirlp >/dev/null 2>&1"
51 then
52 printprocesslog "INFO "$auxdirlp" not available on data. "
53 continue
54 fi
55
56 #rsync from daq to data
57 #if ! /usr/bin/rsync -avxHPu $bwlimit $auxdirdaq $auxdirdata >> $logfile 2>&1 # in case of adding checksum, only update files with rsync
58 if ! rsync -rltDvR -T $rsynctempdir --stats fact@161.72.93.131:$auxdirlp $auxdirisdc >> $logfile 2>&1
59 then
60 printprocesslog "WARN problem rsyncing auxiliary data for "$date" from La Palma to ISDC"
61 echo `date`": problem rsyncing auxiliary data for "$date" from La Palma to ISDC" >> $logfile 2>&1
62 echo `date`": problem rsyncing auxiliary data for "$date" from La Palma to ISDC"
63 fi
64done
65
Note: See TracBrowser for help on using the repository browser.