dry_run=false # mostly for testing
resume_arg=
-temp=$(getopt -l help hcnrt: "$@") || usage 1
+temp=$(getopt -l help hcnprt: "$@") || usage 1
eval set -- "$temp"
while true; do
case $1 in
-c) conf_only=true; shift ;;
-n) dry_run=true; dry_run_arg=-n; shift ;;
+ -p) progress_arg="--progress"; shift ;;
# btrbk arg: Resume only. Skips snapshot creation.
-r) resume_arg=-r; shift ;;
- -t) IFS=, targets=($2); shift 2 ;;
+ -t) IFS=, targets=($2); unset IFS; shift 2 ;;
-h|--help) usage ;;
--) shift; break ;;
*) echo "$0: Internal error!" ; exit 1 ;;
target send-receive ssh://$tg$vol/btrbk
EOF
}
-m() { printf "%s\n" "$*"; "$@"; }
+m() { printf "%s: %s\n" "${0##*/}" "$*"; "$@"; }
if ! which btrbk &>/dev/null; then
echo "$0: error: no btrbk binary found"
fi
-if [[ $- == *i* ]]; then
- progress_arg=--progress
-fi
-
cat >/etc/btrbk.conf <<'EOF'
ssh_identity /root/.ssh/id_rsa
# Just a guess that local7 is a good facility to pick.
targets=($HOME_DOMAIN)
fi
;;
+ treetowl)
+ targets=(frodo)
+ if timeout -s 9 10 ssh x2 :; then
+ targets+=(x2)
+ fi
+ ;;
+ *)
+ targets=(frodo)
+ ;;
esac
- targets=(frodo)
+ echo "targets: ${targets[*]}"
fi