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