| 1 | #!/bin/bash
|
|---|
| 2 | #
|
|---|
| 3 | # This script does a backup of the QLA results
|
|---|
| 4 | # It can be used in different location
|
|---|
| 5 | #
|
|---|
| 6 | # Be careful: do NOT use --delete as on daq callisto files are deleted
|
|---|
| 7 | #
|
|---|
| 8 |
|
|---|
| 9 | source `dirname $0`/../Sourcefile.sh
|
|---|
| 10 | printprocesslog "INFO starting $0"
|
|---|
| 11 |
|
|---|
| 12 | set -C
|
|---|
| 13 |
|
|---|
| 14 | logfile=$runlogpath"/BackupQLA-"$datetime".log"
|
|---|
| 15 | date > $logfile
|
|---|
| 16 |
|
|---|
| 17 | if [ "$1" = "short" ]
|
|---|
| 18 | then
|
|---|
| 19 | dirs=( "/star" "/callisto" "/ganymed_run" )
|
|---|
| 20 | printprocesslog "INFO run only short version of rsyncs for the directories "${dirs[@]}
|
|---|
| 21 | echo "INFO run only short version of rsyncs for the directories "${dirs[@]} >> $logfile
|
|---|
| 22 | fi
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 | # get paths depending on host
|
|---|
| 27 | case $HOSTNAME in
|
|---|
| 28 | daq) from=( "/loc_data/analysis" )
|
|---|
| 29 | to=( "/newdaq/analysis_bu" )
|
|---|
| 30 | ## new temporary solution with rsync-servers
|
|---|
| 31 | #to="newdaq::newdaq/analysis_bu"
|
|---|
| 32 | ;;
|
|---|
| 33 | isdc-dl00) from=( "fact@161.72.93.131:/daq/analysis" "/gpfs0/fact/processing/qla" )
|
|---|
| 34 | #to="/gpfs/scratch/fact/qla"
|
|---|
| 35 | to=( "/gpfs0/fact/processing/qla" "operator@coma.astro.uni-wuerzburg.de:/fact/data/qla")
|
|---|
| 36 | # for new rsync: update variables
|
|---|
| 37 | ;;
|
|---|
| 38 | *) echo "no valid host "$HOSTNAME
|
|---|
| 39 | exit
|
|---|
| 40 | ;;
|
|---|
| 41 | esac
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 | for (( i=0 ; i < ${#from[@]} ; i++ ))
|
|---|
| 46 | do
|
|---|
| 47 | if [ ${#dirs[@]} -gt 0 ]
|
|---|
| 48 | then
|
|---|
| 49 | for dir in ${dirs[@]}
|
|---|
| 50 | do
|
|---|
| 51 | printprocesslog "INFO rsync "${from[$i]}$dir"/ to "${to[$i]}$dir
|
|---|
| 52 | echo "rsync from "${from[$i]}$dir"/ to "${to[$i]}$dir >> $logfile 2>&1
|
|---|
| 53 | if ! rsync -auv ${from[$i]}$dir"/" ${to[$i]}$dir >> $logfile 2>&1
|
|---|
| 54 | then
|
|---|
| 55 | printprocesslog "CONNECTION problem rsyncing QLA from "${from[$i]}$dir"/ to "${to[$i]}$dir
|
|---|
| 56 | echo `date`": problem rsyncing QLA from "${from[$i]}$dir"/ to "${to[$i]}$dir >> $logfile 2>&1
|
|---|
| 57 | fi
|
|---|
| 58 | done
|
|---|
| 59 | else
|
|---|
| 60 | printprocesslog "INFO rsync "${from[$i]}"/ to "${to[$i]}
|
|---|
| 61 | echo "rsync from "${from[$i]}"/ to "${to[$i]} >> $logfile 2>&1
|
|---|
| 62 | if ! rsync -auv ${from[$i]}"/" ${to[$i]} >> $logfile 2>&1
|
|---|
| 63 | then
|
|---|
| 64 | printprocesslog "CONNECTION problem rsyncing QLA from "${from[$i]}"/ to "${to[$i]}
|
|---|
| 65 | echo `date`": problem rsyncing QLA from "${from[$i]}"/ to "${to[$i]} >> $logfile 2>&1
|
|---|
| 66 | fi
|
|---|
| 67 | fi
|
|---|
| 68 | done
|
|---|
| 69 |
|
|---|
| 70 | finish >> $logfile 2>&1
|
|---|
| 71 |
|
|---|