mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-22 22:34:23 -07:00
* usr/bin/byobu-statusd, usr/lib/byobu/.shutil:
- clean up a regression caused by Scott's last patch (for the once run 99999999 notifications)
This commit is contained in:
parent
b44cddce16
commit
c96d8ad71d
3 changed files with 25 additions and 26 deletions
4
debian/changelog
vendored
4
debian/changelog
vendored
|
@ -1,6 +1,8 @@
|
||||||
byobu (4.22) unreleased; urgency=low
|
byobu (4.22) unreleased; urgency=low
|
||||||
|
|
||||||
* UNRELEASED
|
* usr/bin/byobu-statusd, usr/lib/byobu/.shutil:
|
||||||
|
- clean up a regression caused by Scott's last patch (for the once
|
||||||
|
run 99999999 notifications)
|
||||||
|
|
||||||
-- Dustin Kirkland <kirkland@ubuntu.com> Fri, 22 Jul 2011 11:14:37 -0500
|
-- Dustin Kirkland <kirkland@ubuntu.com> Fri, 22 Jul 2011 11:14:37 -0500
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ while true; do
|
||||||
rm -f "$BYOBU_RUN_DIR/status"/* "$BYOBU_RUN_DIR/.last"/*
|
rm -f "$BYOBU_RUN_DIR/status"/* "$BYOBU_RUN_DIR/.last"/*
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
getnow; now=${_RET}
|
get_now; now=${_RET}
|
||||||
# Re-source configuration, if changed since last run
|
# Re-source configuration, if changed since last run
|
||||||
for i in "${BYOBU_PREFIX}/share/$PKG/status/status" "${BYOBU_PREFIX}/share/$PKG/status/statusrc" "$BYOBU_CONFIG_DIR/status" "$BYOBU_CONFIG_DIR/statusrc"; do
|
for i in "${BYOBU_PREFIX}/share/$PKG/status/status" "${BYOBU_PREFIX}/share/$PKG/status/statusrc" "$BYOBU_CONFIG_DIR/status" "$BYOBU_CONFIG_DIR/statusrc"; do
|
||||||
[ -r "$i" ] && [ "$i" -nt "$BYOBU_RUN_DIR/status" ] && . "$i"
|
[ -r "$i" ] && [ "$i" -nt "$BYOBU_RUN_DIR/status" ] && . "$i"
|
||||||
|
@ -48,30 +48,28 @@ while true; do
|
||||||
*/time_binary|*/Makefile.am) continue ;;
|
*/time_binary|*/Makefile.am) continue ;;
|
||||||
esac
|
esac
|
||||||
i=${i##*/}
|
i=${i##*/}
|
||||||
cache="$BYOBU_RUN_DIR/status/$i"
|
cachepath="$BYOBU_RUN_DIR/status/$i"
|
||||||
last="$BYOBU_RUN_DIR/.last/$i"
|
lastpath="$BYOBU_RUN_DIR/.last/$i"
|
||||||
# Check if this status is enabled
|
# Check if this status is enabled
|
||||||
eval x="\$$i"
|
eval x="\$$i"
|
||||||
if [ "$x" != "1" ]; then
|
if [ "$x" != "1" ]; then
|
||||||
rm -f "$cache" "$last"
|
# This item is disabled; clean up and continue
|
||||||
|
rm -f "$cachepath" "$lastpath"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
[ -r "$last" ] && read lastrun < "$last" || lastrun=0
|
[ -r "$lastpath" ] && read lastrun < "$lastpath" || 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"
|
status_freq "$i"
|
||||||
expiry=$(($lastrun+$_RET))
|
expiry=$(($lastrun+$_RET))
|
||||||
find_script "$i" && path="$_RET" || path=/dev/null
|
find_script "$i" && path="$_RET" || path=/dev/null
|
||||||
if [ $now -ge $expiry ] || [ "$path" -nt "$last" ]; then
|
# Re-source status function, if changed since last run
|
||||||
# Re-source status function, if changed since last run
|
if [ "$path" -nt "$lastpath" ] || [ ! -e "$lastpath" ]; then
|
||||||
if [ "$path" -nt "$last" ] || [ ! -e "$last" ]; then
|
. "$path"
|
||||||
. "$path"
|
lastrun=0
|
||||||
fi
|
fi
|
||||||
"__$i" > "$cache"
|
# Update cache now, if necessary
|
||||||
echo "$now" > "$last"
|
if [ $now -ge $expiry ] || [ "$lastrun" = "0" ]; then
|
||||||
|
"__$i" > "$cachepath"
|
||||||
|
echo "$now" > "$lastpath"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
|
@ -257,18 +257,17 @@ status_freq() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
getnow() { _RET=$(date +%s); }
|
get_now() {
|
||||||
if [ -n "${BASH_VERSION}" -a -n "${SECONDS}" ]; then
|
if [ -n "${BASH_VERSION}" ] && [ -n "${SECONDS}" ]; then
|
||||||
getnow() {
|
|
||||||
_RET=${SECONDS}
|
_RET=${SECONDS}
|
||||||
}
|
elif [ -r /proc/cpuinfo ]; then
|
||||||
elif [ -r /proc/cpuinfo ]; then
|
|
||||||
getnow() {
|
|
||||||
# return the integer part of the first item in /proc/uptime
|
# return the integer part of the first item in /proc/uptime
|
||||||
local s c
|
local s c
|
||||||
read s c < /proc/uptime
|
read s c < /proc/uptime
|
||||||
_RET=${s%.*}
|
_RET=${s%.*}
|
||||||
}
|
else
|
||||||
fi
|
_RET=$(date +%s);
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# vi: syntax=sh ts=4 noexpandtab
|
# vi: syntax=sh ts=4 noexpandtab
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue