fixes and some improvements
[distro-setup] / btrbk-run
index 51c2ed6abaaf648397922e67ba0e86859b4b9a4e..86d29e0c7cae496ebbd20f80e6d9be83dab833bd 100644 (file)
--- a/btrbk-run
+++ b/btrbk-run
@@ -190,22 +190,30 @@ fi
 # targets, plus any given on the command line.
 
 
-amy=false
+
+kd_spread=false
 # set default targets
 if [[ ! -v targets && ! $source ]]; then
-  if [[ $HOSTNAME != "$MAIL_HOST" ]] && $cron ; then
-    echo "MAIL_HOST=$MAIL_HOST, nothing to do"
-    mexit 0
-  else
-    amy=true
+  if $cron; then
+    if [[ $HOSTNAME != "$MAIL_HOST" ]]; then
+      if [[ $HOSTNAME == kd && $MAIL_HOST = x2 ]]; then
+        kd_spread=true
+      else
+        echo "MAIL_HOST=$MAIL_HOST, nothing to do"
+        mexit 0
+      fi
+    fi
   fi
 
+  # x2 at home atm
+  kd_spread=false
+
   at_work=false
 
   # todo, fix this up once frodo is back
   # targets=(frodo.b8.nz)
   case $HOSTNAME in
-    x2|kw)
+    kw)
       at_work=true
       ;;&
     x2|x3|sy|bo)
@@ -222,7 +230,11 @@ if [[ ! -v targets && ! $source ]]; then
           home=i.b8.nz
         fi
       else
-        home=b8.nz
+        if ping -q -c1 -w1 b8.nz &>/dev/null; then
+          home=b8.nz
+        else
+          home=i.b8.nz
+        fi
       fi
       ;;&
     x2)
@@ -240,10 +252,12 @@ if [[ ! -v targets && ! $source ]]; then
       fi
       ;;
     kd)
-      if ping -q -c1 -w1 x2.office.fsf.org &>/dev/null; then
-        targets+=(x2.office.fsf.org)
-      else
-        targets+=(x2wg.b8.nz)
+      if ! $kd_spread; then
+        if ping -q -c1 -w1 x2.office.fsf.org &>/dev/null; then
+          targets+=(x2.office.fsf.org)
+        else
+          targets+=(x2wg.b8.nz)
+        fi
       fi
       if ping -q -c1 -w1 sy.b8.nz &>/dev/null; then
         targets+=(sy.b8.nz)
@@ -463,7 +477,7 @@ ssh_identity /q/root/h
 transaction_syslog local7
 
 # trying this out
-stream_compress zstd
+#stream_compress zstd
 
 # so we only run one at a time
 lockfile                   /var/lock/btrbk.lock
@@ -542,16 +556,6 @@ EOF
   fi
 done
 
-# if $amy; then
-#   # to manually backup amy,
-#   # bbk -e -s amy -m root_ubuntubionic
-#   cat >>/etc/btrbk.conf <<'EOF'
-# volume ssh://amy/mnt/root
-# subvolume root_ubuntubionic
-# target send-receive /mnt/root/btrbk
-# EOF
-# fi
-
 # todo: umount first to ensure we don't have any errors
 # todo: do some kill fuser stuff to make umount more reliable