From 893c1f9ade5553f1813c84502ba1b7deae9b9cc0 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 21 Jul 2011 10:50:36 -0400 Subject: [PATCH] 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) --- usr/bin/byobu-statusd | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/usr/bin/byobu-statusd b/usr/bin/byobu-statusd index 12c97663..2762c934 100755 --- a/usr/bin/byobu-statusd +++ b/usr/bin/byobu-statusd @@ -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