Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 37 lines (29 sloc) 773 Bytes
#!/bin/bash
set -e -f -u -o pipefail
# shellcheck disable=SC1090
source "${HOME}/bin/backup-to-rsync-net-lib"
usage() {
printf "Usage: %s [--test-keys-only] HOSTNAME SUBDIR SOURCE_DIR\\n" "$0"
printf "E.g. %s johntobin-laptop Documents /Users/johntobin/Documents\\n" "$0"
}
main() {
local test_keys_only=0
if [[ "$#" -eq 4 && "$1" == "--test-keys-only" ]]; then
test_keys_only=1
shift
fi
if [[ "$#" -ne 3 ]]; then
usage
return 1
fi
local hostname="$1" subdir="$2" source_dir="$3"
if ! check_ssh_key_exists --delete "${hostname}" "${subdir}" \
"${test_keys_only}"; then
return 1
fi
if [[ "${test_keys_only}" -eq 1 ]]; then
return 0
fi
run_rsync --delete "${hostname}" "${subdir}" "${source_dir}"
}
main "$@"
You can’t perform that action at this time.