mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-21 22:13:19 -07:00
Add FreeBSD uptime, fix formatting again
This commit is contained in:
parent
262906b6c1
commit
6f577c0610
2 changed files with 69 additions and 68 deletions
|
@ -30,6 +30,9 @@ __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 [ $(uname) = "FreeBSD" ]; then
|
||||||
|
u=$( sysctl -n kern.boottime | sed -En 's:.*sec = ([[:digit:]]+),.*:\1:p' )
|
||||||
|
u=$(($(date +%s) - $u))
|
||||||
elif [ -x /usr/sbin/sysctl ]; then
|
elif [ -x /usr/sbin/sysctl ]; then
|
||||||
# MacOS support
|
# MacOS support
|
||||||
u=$(/usr/sbin/sysctl -n kern.boottime | cut -f4 -d' ' | cut -d',' -f1)
|
u=$(/usr/sbin/sysctl -n kern.boottime | cut -f4 -d' ' | cut -d',' -f1)
|
||||||
|
@ -52,5 +55,3 @@ __uptime() {
|
||||||
[ -n "$str" ] || return
|
[ -n "$str" ] || return
|
||||||
color w b; printf "%s" "${str}"; color --
|
color w b; printf "%s" "${str}"; color --
|
||||||
}
|
}
|
||||||
|
|
||||||
# vi: syntax=sh ts=4 noexpandtab
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue