if time (or byobu's "now") ever goes backwards, invalidate last-run cache

time could go backwards via a setting of system date backwards.
It could also go backwards if byobu-statusd was running, and then was
killed and started again, but that time it decided to use 'uptime' or
SECONDS to get its 'now'.

in the case of SECONDS, every byobu-statusd will end up on first run
invalidating all cache (which isn't really so bad)
This commit is contained in:
Scott Moser 2011-07-21 10:50:36 -04:00
commit 893c1f9ade

View file

@ -57,6 +57,11 @@ while true; do
continue
fi
[ -r "$last" ] && read lastrun < "$last" || lastrun=0
# if, for any reason the lastrun has a value greater that
# current time, we should run again
[ $lastrun -le $now ] || lastrun=0
status_freq "$i"
expiry=$(($lastrun+$_RET))
find_script "$i" && path="$_RET" || path=/dev/null