Skip to content

Commit

Permalink
fix: Uptime script
Browse files Browse the repository at this point in the history
Return correct values for short (< 1d and <1h)  and long up-times.

Closes YIO-Remote/remote-software#478
  • Loading branch information
zehnm committed Jun 7, 2020
1 parent c9ae4ab commit adb5cca
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions overlay/opt/yio/scripts/uptime.sh
@@ -1,3 +1,2 @@
#!/bin/bash
#awk '{print int($1/3600)":"int(($1%3600)/60)":"int($1%60)}' /proc/uptime
uptime | awk -F'( |,|:)+' '{print $6,"hours,",$7,"minutes"}'
uptime | awk -F'( |,|:)+' '{d=h=m=0; if ($7=="min") m=$6; else {if ($7~/^day/) {d=$6;h=$8;m=$9} else {h=$6;m=$7}}} {print d+0,"d",h+0,"h",m+0,"m"}'

0 comments on commit adb5cca

Please sign in to comment.