3407 |
kakl |
1 |
#!/usr/bin/env bash |
|
|
2 |
# |
|
|
3 |
# sync directory to server |
|
|
4 |
# |
|
|
5 |
# this script should not be called manually |
|
|
6 |
|
|
|
7 |
[[ "$#" -ne 1 ]] && echo "Please provide directory to upload" && exit 1 |
|
|
8 |
|
|
|
9 |
# debug |
|
|
10 |
set -x |
|
|
11 |
|
|
|
12 |
#cd `dirname $1` |
|
|
13 |
#UPDIR=`basename $1` |
|
|
14 |
UPDIR="$1" |
3410 |
kakl |
15 |
STATIONNAME=${PWD##*/} |
3407 |
kakl |
16 |
|
|
|
17 |
# if exclude-list.txt is present, use it |
|
|
18 |
# could as well be changed for rsync -q, but this is more clear |
|
|
19 |
if [[ -f exclude-list.txt ]] |
|
|
20 |
then |
3410 |
kakl |
21 |
rsync -avtz "$UPDIR"/ --rsh='ssh -p2223' --exclude-from='exclude-list.txt' meteor@meteor1.astrozor.cz:meteors/"$STATIONNAME"/"$UPDIR" |
3407 |
kakl |
22 |
else |
3410 |
kakl |
23 |
rsync -avtz "$UPDIR"/ --rsh='ssh -p2223' meteor@meteor1.astrozor.cz:meteors/"$STATIONNAME"/"$UPDIR" |
3407 |
kakl |
24 |
fi |