Merge pull request #383 from konimex/uptime-fix
Solaris: Rewritten uptime
This commit is contained in:
commit
86cfc366c2
1 changed files with 37 additions and 40 deletions
13
neofetch
13
neofetch
|
@ -268,8 +268,6 @@ getkernel() {
|
|||
# Uptime {{{
|
||||
|
||||
getuptime() {
|
||||
case "$os" in
|
||||
"Linux" | "Windows" | "Mac OS X" | "iPhone OS" | "BSD")
|
||||
# Get uptime in seconds
|
||||
case "$os" in
|
||||
"Linux" | "Windows")
|
||||
|
@ -286,6 +284,11 @@ getuptime() {
|
|||
now="$(date +%s)"
|
||||
seconds="$((now - boot))"
|
||||
;;
|
||||
|
||||
"Solaris")
|
||||
seconds="$(kstat -p unix:0:system_misc:snaptime | awk '{print $2}')"
|
||||
seconds="${seconds/.*}"
|
||||
;;
|
||||
esac
|
||||
|
||||
days="$((seconds / 60 / 60 / 24)) days"
|
||||
|
@ -310,12 +313,6 @@ getuptime() {
|
|||
uptime="${days:+$days, }${hours:+$hours, }${minutes}"
|
||||
uptime="${uptime%', '}"
|
||||
uptime="up ${uptime:-${seconds} seconds}"
|
||||
;;
|
||||
|
||||
"Solaris")
|
||||
uptime="$(uptime | /usr/xpg4/bin/awk -F ':[0-9]{2}+[a-z][a-z] |(, ){1}+' '{printf $2}')"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Make the output of uptime smaller.
|
||||
case "$uptime_shorthand" in
|
||||
|
|
Loading…
Reference in a new issue