Line 9... |
Line 9... |
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 |
#cd `dirname $1` |
- |
|
15 |
#UPDIR=`basename $1` |
- |
|
16 |
UPDIR="$1" |
14 |
UPDIR="$2" |
17 |
STATIONNAME=${PWD##*/} |
15 |
STATIONNAME=${PWD##*/} |
- |
|
16 |
OBSERVATORYNAME="$1" |
- |
|
17 |
|
- |
|
18 |
#echo "$1 ; $2 ; $3 ; $4" >> /media/sd/meteors/debug.log |
18 |
|
19 |
|
19 |
# if exclude-list.txt is present, use it |
20 |
# if exclude-list.txt is present, use it |
20 |
# 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 |
21 |
if [[ -f exclude-list.txt ]] |
22 |
if [[ -f exclude-list.txt ]] |
22 |
then |
23 |
then |
23 |
rsync -vvtz $2 $3 "$UPDIR"/ --rsh='ssh -p2223' --exclude-from='exclude-list.txt' meteor@meteor1.astrozor.cz:meteors/"$STATIONNAME"/"$UPDIR" |
24 |
rsync -vvtz $3 $4 "$UPDIR"/ --exclude-from='exclude-list.txt' "$OBSERVATORYNAME"@space.astro.cz:/storage/meteors/"$OBSERVATORYNAME"/"$STATIONNAME"/"$UPDIR" |
24 |
else |
25 |
else |
25 |
rsync -vvtz $2 $3 "$UPDIR"/ --rsh='ssh -p2223' meteor@meteor1.astrozor.cz:meteors/"$STATIONNAME"/"$UPDIR" |
26 |
rsync -vvtz $3 $4 "$UPDIR"/ "$OBSERVATORYNAME"@space.astro.cz:/storage/meteors/"$OBSERVATORYNAME"/"$STATIONNAME"/"$UPDIR" |
26 |
fi |
27 |
fi |