Rev 3417 Rev 3449
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 "$1 ; $2 ; $3" -  
8 echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 7 echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
9   8  
10 [[ "$#" < 1 ]] && echo "Please provide directory to upload" && exit 1 9 [[ "$#" < 1 ]] && echo "Please provide directory to upload" && exit 1
11   10  
12 # debug 11 # debug
13 set -x 12 set -x
14   13  
15 #cd `dirname $1` 14 #cd `dirname $1`
16 #UPDIR=`basename $1` 15 #UPDIR=`basename $1`
17 UPDIR="$1" 16 UPDIR="$1"
18 STATIONNAME=${PWD##*/} 17 STATIONNAME=${PWD##*/}
19   18  
20 # if exclude-list.txt is present, use it 19 # if exclude-list.txt is present, use it
21 # could as well be changed for rsync -q, but this is more clear 20 # could as well be changed for rsync -q, but this is more clear
22 if [[ -f exclude-list.txt ]] 21 if [[ -f exclude-list.txt ]]
23 then 22 then
24 rsync -vvtz $2 $3 "$UPDIR"/ --rsh='ssh -p2223' --exclude-from='exclude-list.txt' meteor@meteor1.astrozor.cz:meteors/"$STATIONNAME"/"$UPDIR" 23 rsync -vvtz $2 $3 "$UPDIR"/ --rsh='ssh -p2223' --exclude-from='exclude-list.txt' meteor@meteor1.astrozor.cz:meteors/"$STATIONNAME"/"$UPDIR"
25 else 24 else
26 rsync -vvtz $2 $3 "$UPDIR"/ --rsh='ssh -p2223' meteor@meteor1.astrozor.cz:meteors/"$STATIONNAME"/"$UPDIR" 25 rsync -vvtz $2 $3 "$UPDIR"/ --rsh='ssh -p2223' meteor@meteor1.astrozor.cz:meteors/"$STATIONNAME"/"$UPDIR"
27 fi 26 fi