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 |
|
|
|
14 |
#cd `dirname $1` |
|
|
15 |
#UPDIR=`basename $1` |
|
|
16 |
UPDIR="$1" |
3410 |
kakl |
17 |
STATIONNAME=${PWD##*/} |
3407 |
kakl |
18 |
|
|
|
19 |
# if exclude-list.txt is present, use it |
|
|
20 |
# could as well be changed for rsync -q, but this is more clear |
|
|
21 |
if [[ -f exclude-list.txt ]] |
|
|
22 |
then |
3417 |
kakl |
23 |
rsync -vvtz $2 $3 "$UPDIR"/ --rsh='ssh -p2223' --exclude-from='exclude-list.txt' meteor@meteor1.astrozor.cz:meteors/"$STATIONNAME"/"$UPDIR" |
3407 |
kakl |
24 |
else |
3417 |
kakl |
25 |
rsync -vvtz $2 $3 "$UPDIR"/ --rsh='ssh -p2223' meteor@meteor1.astrozor.cz:meteors/"$STATIONNAME"/"$UPDIR" |
3407 |
kakl |
26 |
fi |