X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=btrbk-run;h=cf7cf836f4ec96f966dc477d7fee631dbdcd68d2;hb=957654ed1672c7ca933583549b9d8e9f37b1c802;hp=2eb53c1e25700c6b7dad52e02a9eaf1bcdab2d2b;hpb=63e3670ab59869f5f74904edbe64daa943fad15f;p=distro-setup diff --git a/btrbk-run b/btrbk-run index 2eb53c1..cf7cf83 100644 --- a/btrbk-run +++ b/btrbk-run @@ -261,21 +261,26 @@ if [[ ! -v targets && ! $source ]]; then ;;& *) if $at_home; then - if ! $kd_spread; then + if ! $kd_spread && [[ $HOSTNAME != x3 ]]; then # main work machine if ping -q -c1 -w1 x3.office.fsf.org &>/dev/null; then targets+=(x3.office.fsf.org) + elif ping -q -c1 -w1 $h.b8.nz &>/dev/null; then + # in case we took it home + targets+=(x3.b8.nz) else targets+=(x3wg.b8.nz) fi fi - for h in frodo kd; do + # temporarily disabled while doing recovery + # for h in frodo kd; do + for h in kd; do if [[ $HOSTNAME == "$h" ]]; then continue fi targets+=($h.b8.nz) done - for h in x2 x3 sy; do + for h in x2 sy; do if [[ $HOSTNAME == "$h" ]]; then continue fi @@ -345,6 +350,9 @@ else if [[ $HOSTNAME == "$HOST2" ]]; then prospective_mps+=(/a /ar /qr /q) fi + if $kd_spread; then + prospective_mps=(/a /ar /o /qr /q) + fi fi # note: put q last just in case its specific retention options were to # affect other config sections. I havent tested if that is the case. @@ -362,10 +370,15 @@ else done fi +if (( ! ${#mountpoints[@]} )); then + die didnt get mountpoint arg and had no defaults +fi + echo "mountpoints: ${mountpoints[*]}" ##### end command line parsing ######## +# todo: this has a timing problem, since btrbk.timer could activate the service after this check. if ! $fast && [[ $source ]]; then if [[ $(ssh $source ps --no-headers -o comm 1) == systemd ]]; then status=$(ssh $source systemctl is-active btrbk.service) || : # normally returns 3 @@ -659,7 +672,9 @@ done if [[ $source ]]; then m mount-latest-subvol "${subvols[@]}" else - m /a/exe/mount-latest-remote ${targets[@]} + for tg in ${targets[@]}; do + m /a/exe/mount-latest-remote "$tg" "${subvols[@]}" || ret=$? + done fi if [[ $ret == 0 ]]; then