Rev 3626 Rev 3627
1 #!/usr/bin/env bash 1 #!/usr/bin/env bash
2 # 2 #
3 # sync directory to server 3 # sync directory to server
4 # 4 #
5 # this script should not be called manually 5 # this script should not be called manually
6   6  
7 echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 7 echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
8   8  
9 [[ "$#" < 1 ]] && echo "Please provide directory to upload" && exit 1 9 [[ "$#" < 1 ]] && echo "Please provide directory to upload" && exit 1
10   10  
11 # debug 11 # debug
12 set -x 12 set -x
13   13  
14 UPDIR="$2" 14 UPDIR="$2"
15 STATIONNAME=${PWD##*/} 15 STATIONNAME=${PWD##*/}
16 OBSERVATORYNAME="$1" 16 OBSERVATORYNAME="$1"
17   17  
18 #echo "$1 ; $2 ; $3 ; $4" >> /media/sd/meteors/debug.log 18 #echo "$1 ; $2 ; $3 ; $4" >> /media/sd/meteors/debug.log
19   19  
20 # if exclude-list.txt is present, use it 20 # if exclude-list.txt is present, use it
21 # could as well be changed for rsync -q, but this is more clear 21 # could as well be changed for rsync -q, but this is more clear
22 if [[ -f exclude-list.txt ]] 22 if [[ -f exclude-list.txt ]]
23 then 23 then
24 rsync -vvtz $3 $4 "$UPDIR"/ --exclude-from='exclude-list.txt' "$OBSERVATORYNAME"@space.astro.cz:/storage/robozor/"$OBSERVATORYNAME"/"$STATIONNAME"/"$UPDIR" 24 rsync -vvtz $3 $4 "$UPDIR"/ --exclude-from='exclude-list.txt' "$OBSERVATORYNAME"@space.astro.cz:/storage/bolidozor/"$OBSERVATORYNAME"/"$STATIONNAME"/"$UPDIR"
25 else 25 else
26 rsync -vvtz $3 $4 "$UPDIR"/ "$OBSERVATORYNAME"@space.astro.cz:/storage/robozor/"$OBSERVATORYNAME"/"$STATIONNAME"/"$UPDIR" 26 rsync -vvtz $3 $4 "$UPDIR"/ "$OBSERVATORYNAME"@space.astro.cz:/storage/bolidozor/"$OBSERVATORYNAME"/"$STATIONNAME"/"$UPDIR"
27 fi 27 fi