esac
done
-# usefull commands are resume and archive
+# only tested commands are resume and archive
cmd_arg=${1:-run}
+case $cmd_arg in
+ run|resume|archive) : ;;
+ *) die "untested command arg" ;;
+esac
+
+if (( $# > 1 )); then
+ die: "only 1 nonoption arg is supported"
+fi
+
if [[ -v targets && $source ]]; then
die "error: -t and -s are mutually exclusive"
fi
# ;;
*)
prospective_mps=(/a /q)
- if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
- prospective_mps+=(/o)
+ if [[ $source ]]; then
+ source_state="$(ssh $source cat /a/bin/bash_unpublished/source-state)"
+ eval "$source_state"
+ source_host="$(ssh $source cat /etc/hostname)"
+ if [[ $source_host == "$MAIL_HOST" ]]; then
+ prospective_mps+=(/o)
+ fi
+ else
+ if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
+ prospective_mps+=(/o)
+ fi
fi
;;
esac
echo "mountpoints: ${mountpoints[*]}"
+##### end command line parsing ########
+if [[ $source ]]; then
+ if [[ $(ssh $source systemctl is-active btrbk.service) != inactive ]]; then
+ echo "$0: error: cron btrbk is running on source. exiting out of caution"
+ exit 1
+ fi
+fi
# pull_reexec stops us from getting into an infinite loop if there is some
# kind of weird problem
fi
-##### end command line parsing ########