conf_only=false
dry_run=false # mostly for testing
+resume_arg=
-temp=$(getopt -l help hcnt: "$@") || usage 1
+temp=$(getopt -l help hcnrt: "$@") || 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 ;;
+ -r) resume_arg=-r; shift ;;
-t) IFS=, targets=($2); shift 2 ;;
-h|--help) usage ;;
--) shift; break ;;
# a subvol on current host is not fresh.
# umount first to ensure we don't have any errors
# todo: do some kill fuser stuff to make umount more reliable
-# todo: run this on a systemd timer on $primary, once per hour.
+# todo: run this on a systemd timer on $primary, once per hour,
+# and if primary is, change that timer over to primary, and make
+# sure we mount the latest
# todo: setup lock so that if this is already running, we exit out, so
# that manual runs don't interfere with cronjobs.
fi
if $dry_run; then
- btrbk -n run
+ btrbk -n $resume_arg run
else
- btrbk -q run
+ btrbk -q $resume_arg run
fi
# if we have /p, rsync to targets without /p
if ! $dry_run; then
for tg in ${targets[@]}; do
scp $script_dir/{mount-latest-subvol,check-subvol-stale} \
- root@tg:/usr/local/bin
+ root@$tg:/usr/local/bin
ssh root@$tg bash <<'EOF'
set -e
chmod +x /usr/local/bin/{mount-latest-subvol,check-subvol-stale}