Changeset 14841 for trunk/DataCheck/Transfer/RsyncAuxLP.sh
- Timestamp:
- 02/04/13 06:03:36 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataCheck/Transfer/RsyncAuxLP.sh
r13599 r14841 1 1 #!/bin/bash 2 2 3 # this script has been written to run on La Palma on the machine da ta3 # this script has been written to run on La Palma on the machine daq 4 4 # i.e. paths are only working on this machine 5 5 … … 11 11 12 12 # check if /daq is mounted on data 13 if ! mount | grep da q>> $logfile 2>&113 if ! mount | grep data >> $logfile 2>&1 14 14 then 15 printprocesslog "ERROR /da q is not mounted on data=> please mount it"16 echo `date`": /da q is not mounted on data=> please mount it"15 printprocesslog "ERROR /data is not mounted on daq => please mount it" 16 echo `date`": /data is not mounted on daq => please mount it" 17 17 finish 18 18 fi 19 19 20 20 # check if paths are available 21 if ! ls /da q/aux >/dev/null 2>&121 if ! ls /data/aux >/dev/null 2>&1 22 22 then 23 printprocesslog "ERROR /da q/aux is not available."23 printprocesslog "ERROR /data/aux is not available." 24 24 finish 25 25 fi … … 30 30 fi 31 31 32 # do the rsync for the last 6 days 33 dirs=( `ssh newdaq "find /loc_data/aux/ -mindepth 3 -type d | sort | tail -6"` ) 32 34 33 # get last 3, 6 or 9 nights 34 dates=( `date +%Y/%m/%d --date="-12hour"` `date +%Y/%m/%d --date="-36hour"` `date +%Y/%m/%d --date="-60hour"` \ 35 `date +%Y/%m/%d --date="-84hour"` `date +%Y/%m/%d --date="-108hour"` `date +%Y/%m/%d --date="-132hour"` \ 36 `date +%Y/%m/%d --date="-156hour"` `date +%Y/%m/%d --date="-180hour"` `date +%Y/%m/%d --date="-204hour"` \ 37 ) 38 39 # do rsync for rawfiles of these dates 40 for date in ${dates[@]} 35 # do rsync for auxfiles in these directories 36 for dir in ${dirs[@]} 41 37 do 42 38 echo "" >> $logfile 2>&1 43 # auxiliary data directories on data 44 auxdirdaq=/daq/aux/$date/ # /loc_data from daq via nfs on data 45 if ! [ -d $auxdirdaq ] 39 # directory on daq 40 if ! [ -d $dir ] 46 41 then 47 auxdirdata=/loc_data/aux/$date/ 48 if ! [ -d $auxdirdata ] 49 then 50 printprocesslog "INFO "$auxdirdaq" and "$auxdirdata" not found. " >> $logfile 2>&1 51 else 52 printprocesslog "WARN "$auxdirdaq" not found, but "$auxdirdata". Data were probably taken on data." >> $logfile 2>&1 53 fi 54 echo `date`": "$auxdirdaq" not found. " >> $logfile 2>&1 55 continue 42 mkdir -pv $dir >> $logfile 2>&1 56 43 fi 57 auxdirdata=/loc_data/aux/$date 58 if ! [ -d $auxdirdata ] 44 # directory on data 45 dirdata=`echo $dir | sed -e 's/loc_//'` 46 if ! [ -d $dirdata ] 59 47 then 60 mkdir -pv $ auxdirdata >> $logfile 2>&148 mkdir -pv $dirdata >> $logfile 2>&1 61 49 fi 62 printprocesslog "INFO processing files in "$ auxdirdaq>> $logfile 2>&163 echo `date`": processing files in "$ auxdirdaq>> $logfile 2>&150 printprocesslog "INFO processing files in "$dir >> $logfile 2>&1 51 echo `date`": processing files in "$dir >> $logfile 2>&1 64 52 65 53 # get current hour … … 70 58 # limit bw for rsync to 20 MB/s during night 71 59 bwlimit="--bwlimit=20000" 72 printprocesslog "INFO rsync datawith "$bwlimit >> $logfile 2>&173 echo "rsync datawith "$bwlimit >> $logfile 2>&160 printprocesslog "INFO rsync files with "$bwlimit >> $logfile 2>&1 61 echo "rsync files with "$bwlimit >> $logfile 2>&1 74 62 else 75 63 # no bw limit during day 76 printprocesslog "INFO rsync data without bwlimit" >> $logfile 2>&1 77 echo "rsync data without bwlimit" >> $logfile 2>&1 64 printprocesslog "INFO rsync files without bwlimit" >> $logfile 2>&1 65 echo "rsync files without bwlimit" >> $logfile 2>&1 66 fi 67 68 # rsync from newdaq to daq 69 if ! /usr/bin/rsync -avxHP -T $rsynctempdir $bwlimit newdaq:$dir/ $dir >> $logfile 2>&1 70 then 71 printprocesslog "WARN problem rsyncing auxiliary files in "$dir" from newdaq to daq" 72 echo `date`": problem rsyncing auxiliary files in "$dir" from newdaq to daq" 78 73 fi 79 74 80 75 #rsync from daq to data 81 #if ! /usr/bin/rsync -avxHPu $bwlimit $auxdirdaq $auxdirdata >> $logfile 2>&1 # in case of adding checksum, only update files with rsync 82 if ! /usr/bin/rsync -avxHP -T $rsynctempdir $bwlimit $auxdirdaq $auxdirdata >> $logfile 2>&1 76 if ! /usr/bin/rsync -avxHP -T $rsynctempdir $bwlimit $dir/ $dirdata >> $logfile 2>&1 83 77 then 84 printprocesslog "WARN problem rsyncing auxiliary data for "$date" from daq to data"85 echo `date`": problem rsyncing auxiliary data for "$date" from daq to data"78 printprocesslog "WARN problem rsyncing auxiliary files in "$dir" from daq to data" 79 echo `date`": problem rsyncing auxiliary files in "$dir" from daq to data" 86 80 fi 87 81 done
Note:
See TracChangeset
for help on using the changeset viewer.