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
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