backup improvement
authorIan Kelling <ian@iankelling.org>
Sat, 27 Apr 2024 21:40:49 +0000 (17:40 -0400)
committerIan Kelling <ian@iankelling.org>
Sat, 27 Apr 2024 22:07:26 +0000 (18:07 -0400)
btrbk-run

index ae16266fbe149394753e8810657c422db7c3d9ce..b4bd302918c0a559328ee8d3fa8a7e07c95f87e9 100644 (file)
--- a/btrbk-run
+++ b/btrbk-run
@@ -113,12 +113,21 @@ add-x3-target() {
   fi
 }
 
-add-wireless-target-h() {
-  if ping -q -c1 -w1 $h.b8.nz &>/dev/null; then
-    targets+=($h.b8.nz)
-  elif ping -q -c1 -w1 ${h}w.b8.nz &>/dev/null; then
-    targets+=(${h}w.b8.nz)
+add-wireless-target() {
+  local host
+  if [[ ! $1 ]]; then
+    set -- $h
   fi
+  for host; do
+    # c = cabled, w = wireless
+    if ping -q -c1 -w1 ${host}c.b8.nz &>/dev/null; then
+      targets+=(${host}c.b8.nz)
+    elif ping -q -c1 -w1 $host.b8.nz &>/dev/null; then
+      targets+=($host.b8.nz)
+    elif ping -q -c1 -w1 ${host}w.b8.nz &>/dev/null; then
+      targets+=(${host}w.b8.nz)
+    fi
+  done
 }
 
 qconf() {
@@ -288,8 +297,7 @@ if $kd_spread; then
   fi
   cmd_arg=resume
   preserve_arg=-p
-  h=sy
-  add-wireless-target-h
+  add-wireless-target sy so
 fi
 
 if [[ ! $cmd_arg ]]; then
@@ -370,7 +378,7 @@ if [[ ! -v targets && ! $source ]]; then
     )
     for h in ${wireless_home_hosts[@]}; do
       if [[ $HOSTNAME != "$h" ]]; then
-        add-wireless-target-h
+        add-wireless-target
       fi
     done
   elif $at_work; then
@@ -612,7 +620,7 @@ df --output=size,pcent / | tail -n1"
     min_root_kb=$(( 1024 * 1024 * 200 )) # 200 gb
     tmp=$(( root_size < min_root_kb ))
     if (( tmp )); then
-      e "warning: $h: root_size=$root_zie < 200gb, perhaps it is booted to bootstrap vol. skipping for now"
+      e "warning: $h: root_size=$root_size < 200gb, perhaps it is booted to bootstrap vol. skipping for now"
       continue
     fi