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

Last change on this file since 13106 was 13065, checked in by Daniela Dorner, 13 years ago
added temp directory for rsync
  • Property svn:executable set to *
File size: 2.2 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 nights
13dates=( `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
16for date in ${dates[@]}
17do
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
55done
56
Note: See TracBrowser for help on using the repository browser.