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