print uptime
This commit is contained in:
15
nando-stats
15
nando-stats
@@ -11,6 +11,19 @@ function filesize {
|
||||
}' || return $?
|
||||
}
|
||||
|
||||
function shorttime {
|
||||
awk 'BEGIN{ x = '$1'
|
||||
split("s m h d",type)
|
||||
split("1 60 3600 86400",divisor)
|
||||
for(i=4;y < 1;i--)
|
||||
y = x / (divisor[i])
|
||||
str=int(y) type[i+1]
|
||||
if (x==0) { str = "0" }
|
||||
print str
|
||||
}' || return $?
|
||||
|
||||
}
|
||||
|
||||
cores=$( grep -c processor /proc/cpuinfo )
|
||||
load=$( cat /proc/loadavg | cut -d" " -f3 | tr -d [:cntrl:] )
|
||||
echo -n "L:$load/$cores M:"
|
||||
@@ -27,5 +40,7 @@ echo -n "$used+$cache/$total U:"
|
||||
ps a --format user| grep -v -e root -e USER | sort -u | wc -l | tr -c -d [:digit:]
|
||||
printf " R/H:%s/%s" $( df / | awk '{print $5}' | tail -n +2 ) $( df /home | awk '{print $5}' | tail -n +2 )
|
||||
|
||||
printf " up:%s" $( shorttime $( cut -d" " -f1 /proc/uptime ) )
|
||||
|
||||
# exit okay
|
||||
true
|
||||
|
||||
Reference in New Issue
Block a user