mostly fixes, some new scripts
[distro-setup] / ziva-backup-check
index 849453d758bb59e674147f9ac0397e3c42b62304..1d5e4328761cbb1dfac71eda27ccb87445bb5b23 100755 (executable)
@@ -18,8 +18,15 @@ fi
 
 
 ## begin check on btrbk
-age_limit_sec=$(( 60 * 60 * 50 )) # 50 hours
+age_limit_sec=$(( 60 * 60 * 74 )) # 74 hours
 for prefix in root boot; do
+  if [[ $prefix == boot ]]; then
+    # its not uncommon for the /boot subvol to have no changes, and thus
+    # no new backups for 10 days or so. todo: instead of this error
+    # prone check, we should make it so the ziva computer will
+    # touch a file on our computer whenever btrbk succeeds
+    age_limit_sec=$(( age_limit_sec + 60* 60 * 24 * 15 ))
+  fi
   vol=${prefix}_ubuntubionic
   snaps=(/mnt/r7/amy/$prefix/btrbk/${vol}.20*)
   if [[ ! ${snaps[*]} ]]; then
@@ -33,7 +40,7 @@ for prefix in root boot; do
       unix_time=$(date -d $(sed -r  's/(.{4})(..)(.{5})(..)(.*)/\1-\2-\3:\4:\5/' <<<${f#$vol.}) +%s)
       printf "%s %s\n" $unix_time $s # part of the pipeline
     done | sort -r | head -n 1 ||:
-           )
+  )
   if [[ ! $last_snap ]]; then
     # should not happen.
     err "could not find latest snapshot for $svp among ${snaps[*]}"