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

Last change on this file since 13154 was 13108, checked in by Daniela Dorner, 13 years ago
added check if directory exists
  • Property svn:executable set to *
File size: 2.4 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 if ! ssh fact@161.72.93.131 "ls $auxdirlp >/dev/null 2>&1"
48 then
49 printprocesslog "INFO "$auxdirlp" not available on data. "
50 continue
51 fi
52
53 #rsync from daq to data
54 #if ! /usr/bin/rsync -avxHPu $bwlimit $auxdirdaq $auxdirdata >> $logfile 2>&1 # in case of adding checksum, only update files with rsync
55 if ! rsync -rltDvR -T $rsynctempdir --stats fact@161.72.93.131:$auxdirlp $auxdirisdc >> $logfile 2>&1
56 then
57 printprocesslog "WARN problem rsyncing auxiliary data for "$date" from La Palma to ISDC"
58 echo `date`": problem rsyncing auxiliary data for "$date" from La Palma to ISDC" >> $logfile 2>&1
59 echo `date`": problem rsyncing auxiliary data for "$date" from La Palma to ISDC"
60 fi
61done
62
Note: See TracBrowser for help on using the repository browser.