fixes
authorIan Kelling <ian@iankelling.org>
Wed, 10 May 2023 14:15:04 +0000 (10:15 -0400)
committerIan Kelling <ian@iankelling.org>
Wed, 10 May 2023 14:15:04 +0000 (10:15 -0400)
btrbk-run
myi3status

index f768ad4ffff561c65bf1d67ac3d8d9a02a9b74d6..92e69679c017dd19c776160fbf7e2fc2edf638c8 100644 (file)
--- a/btrbk-run
+++ b/btrbk-run
@@ -510,7 +510,7 @@ else
       else
         locked=true
       fi
-      if $locked; then
+      if $locked; then
         # Ignore this host. i sometimes use a non-main machine for
         # testing or web browsing, knowing that everything will be wiped
         # by the next backup, but I dont want it to happen as Im using
index 500fd8f5ec08ce3589d01f230789f52cfbe60fc5..1bf14c1c058ab08971ba7b95d8cc2e268d2eb85d 100755 (executable)
@@ -21,19 +21,27 @@ fast_blocks=30
 start=$EPOCHSECONDS
 domins=true
 
-day_tmp=$(cat /b/data/daystart)
-day_start_hour=${day_tmp%??}
-day_start_min=${day_tmp: -2}
-echo $day_start_hour > /b/data/daystart-generated
-echo $day_start_min >> /b/data/daystart-generated
-day_start=$(date -d $day_start_hour:$day_start_min +%s)
-# for after midnight but before the day start.
-if (( day_start > EPOCHSECONDS )); then
-  day_start=$(date -d "$day_start_hour:$day_start_min yesterday" +%s)
-fi
+
+
+get_daystart() {
+  if [[ /b/data/daystart -ot /b/data/daystart-generated && $day_tmp ]]; then
+    return 0
+  fi
+  day_tmp=$(cat /b/data/daystart)
+  day_start_hour=${day_tmp%??}
+  day_start_min=${day_tmp: -2}
+  echo $day_start_hour > /b/data/daystart-generated
+  echo $day_start_min >> /b/data/daystart-generated
+  day_start=$(date -d $day_start_hour:$day_start_min +%s)
+  # for after midnight but before the day start.
+  if (( day_start > EPOCHSECONDS )); then
+    day_start=$(date -d "$day_start_hour:$day_start_min yesterday" +%s)
+  fi
+}
 
 
 main() {
+  get_daystart
 
   ## debug
   # if [[ $line ]]; then