Rev 3415 Rev 3417
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 7 echo "$1 ; $2 ; $3"
8 echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 8 echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
9   9  
10 [[ "$#" < 1 ]] && echo "Please provide directory to upload" && exit 1 10 [[ "$#" < 1 ]] && echo "Please provide directory to upload" && exit 1
11   11  
12 # debug 12 # debug
13 set -x 13 set -x
14   14  
15 #cd `dirname $1` 15 #cd `dirname $1`
16 #UPDIR=`basename $1` 16 #UPDIR=`basename $1`
17 UPDIR="$1" 17 UPDIR="$1"
18 STATIONNAME=${PWD##*/} 18 STATIONNAME=${PWD##*/}
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 -avvtz "$2" "$UPDIR"/ --rsh='ssh -p2223' --exclude-from='exclude-list.txt' meteor@meteor1.astrozor.cz:meteors/"$STATIONNAME"/"$UPDIR" 24 rsync -vvtz $2 $3 "$UPDIR"/ --rsh='ssh -p2223' --exclude-from='exclude-list.txt' meteor@meteor1.astrozor.cz:meteors/"$STATIONNAME"/"$UPDIR"
25 else 25 else
26 rsync -avvtz "$2" "$UPDIR"/ --rsh='ssh -p2223' meteor@meteor1.astrozor.cz:meteors/"$STATIONNAME"/"$UPDIR" 26 rsync -vvtz $2 $3 "$UPDIR"/ --rsh='ssh -p2223' meteor@meteor1.astrozor.cz:meteors/"$STATIONNAME"/"$UPDIR"
27 fi 27 fi