mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-21 22:13:19 -07:00
Fixes the uptime status notification on OS X.
This commit is contained in:
parent
85c1971722
commit
757ba0fbdc
1 changed files with 11 additions and 4 deletions
|
@ -30,6 +30,12 @@ __uptime() {
|
||||||
if [ -r /proc/uptime ]; then
|
if [ -r /proc/uptime ]; then
|
||||||
read u idle < /proc/uptime
|
read u idle < /proc/uptime
|
||||||
u=${u%.*}
|
u=${u%.*}
|
||||||
|
elif [ -x /usr/sbin/sysctl ]; then
|
||||||
|
u=$(/usr/sbin/sysctl -n kern.boottime | cut -f4 -d' ' | cut -d',' -f1)
|
||||||
|
u=$(($(date +%s) - $u))
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$u" ]; then
|
||||||
if [ "$u" -gt 86400 ]; then
|
if [ "$u" -gt 86400 ]; then
|
||||||
str="$(($u / 86400))d$((($u % 86400) / 3600))h"
|
str="$(($u / 86400))d$((($u % 86400) / 3600))h"
|
||||||
elif [ "$u" -gt 3600 ]; then
|
elif [ "$u" -gt 3600 ]; then
|
||||||
|
@ -42,6 +48,7 @@ __uptime() {
|
||||||
else
|
else
|
||||||
str=$(uptime | sed -e "s/.* up *//" -e "s/ *days, */d/" -e "s/:/h/" -e "s/,.*/m/")
|
str=$(uptime | sed -e "s/.* up *//" -e "s/ *days, */d/" -e "s/:/h/" -e "s/,.*/m/")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -n "$str" ] || return
|
[ -n "$str" ] || return
|
||||||
color w b; printf "%s" "${str}"; color --
|
color w b; printf "%s" "${str}"; color --
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue