From: Ian Kelling Date: Wed, 10 May 2023 14:15:04 +0000 (-0400) Subject: fixes X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=commitdiff_plain;h=dc8de4077c6b6a7ae3678e3be1d639dc9219cd77 fixes --- diff --git a/btrbk-run b/btrbk-run index f768ad4..92e6967 100644 --- 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 diff --git a/myi3status b/myi3status index 500fd8f..1bf14c1 100755 --- a/myi3status +++ b/myi3status @@ -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