Changeset 14841 for trunk


Ignore:
Timestamp:
02/04/13 06:03:36 (12 years ago)
Author:
Daniela Dorner
Message:
adapted to new structure in LP (newdaq, new transfer scheme)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataCheck/Transfer/RsyncAuxLP.sh

    r13599 r14841  
    11#!/bin/bash
    22
    3 # this script has been written to run on La Palma on the machine data
     3# this script has been written to run on La Palma on the machine daq
    44#   i.e. paths are only working on this machine
    55
     
    1111
    1212# check if /daq is mounted on data
    13 if ! mount | grep daq >> $logfile 2>&1
     13if ! mount | grep data >> $logfile 2>&1
    1414then
    15    printprocesslog "ERROR /daq is not mounted on data => please mount it"
    16    echo `date`": /daq 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"
    1717   finish
    1818fi
    1919
    2020# check if paths are available
    21 if ! ls /daq/aux >/dev/null 2>&1
     21if ! ls /data/aux >/dev/null 2>&1
    2222then
    23    printprocesslog "ERROR /daq/aux is not available."
     23   printprocesslog "ERROR /data/aux is not available."
    2424   finish
    2525fi
     
    3030fi
    3131
     32# do the rsync for the last 6 days
     33dirs=( `ssh newdaq "find /loc_data/aux/ -mindepth 3 -type d | sort | tail -6"` )
    3234
    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
     36for dir in ${dirs[@]}
    4137do
    4238   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 ]
    4641   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
    5643   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 ]
    5947   then
    60       mkdir -pv $auxdirdata >> $logfile 2>&1
     48      mkdir -pv $dirdata >> $logfile 2>&1
    6149   fi
    62    printprocesslog "INFO processing files in "$auxdirdaq >> $logfile 2>&1
    63    echo `date`": processing files in "$auxdirdaq >> $logfile 2>&1
     50   printprocesslog "INFO processing files in "$dir >> $logfile 2>&1
     51   echo `date`": processing files in "$dir >> $logfile 2>&1
    6452   
    6553   # get current hour
     
    7058      # limit bw for rsync to 20 MB/s during night
    7159      bwlimit="--bwlimit=20000"
    72       printprocesslog "INFO rsync data with "$bwlimit >> $logfile 2>&1
    73       echo "rsync data with "$bwlimit >> $logfile 2>&1
     60      printprocesslog "INFO rsync files with "$bwlimit >> $logfile 2>&1
     61      echo "rsync files with "$bwlimit >> $logfile 2>&1
    7462   else
    7563      # 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"
    7873   fi
    7974   
    8075   #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
    8377   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"
    8680   fi
    8781done
Note: See TracChangeset for help on using the changeset viewer.