tazpanel rev 628

hardware.cgi: fix mem usage
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Jul 07 11:52:21 2019 +0200 (3 months ago)
parents b932799f8ae1
children 4c4eaaf30902
files hardware.cgi
line diff
     1.1 --- a/hardware.cgi	Sat Jul 06 15:03:14 2019 +0200
     1.2 +++ b/hardware.cgi	Sun Jul 07 11:52:21 2019 +0200
     1.3 @@ -342,7 +342,7 @@
     1.4  
     1.5  		# CPU frequency
     1.6  		if [ -n "$(ls /sys/devices/system/cpu/*/cpufreq/cpuinfo_cur_freq 2>/dev/null)" ]; then
     1.7 -			echo "<p><span data-icon=\"@daemons@\">$(_ 'CPU:')</span>"
     1.8 +			echo "<p><span data-icon=\"@daemons@\">$(sed '/name/!ds|.*: ||;q' /proc/cpuinfo) :</span>"
     1.9  			for f in /sys/devices/system/cpu/*/cpufreq/cpuinfo_cur_freq; do
    1.10  				awk '{ print $1/1000 "MHz" }' < $f
    1.11  			done
    1.12 @@ -610,8 +610,8 @@
    1.13  		# System memory
    1.14  		#
    1.15  		mem_total=$(free -m | awk '$1 ~ "M" {print $2}')
    1.16 -		mem_used=$((100 * $(free -m | awk '$1 ~ "+" {print $3}') / mem_total))
    1.17 -		mem_buff=$((100 * $(free -m | awk '$1 ~ "M" {print $6}') / mem_total))
    1.18 +		mem_used=$((100 * $(free -m | awk '$1 ~ "M" {print $3}') / $mem_total))
    1.19 +		mem_buff=$((100 * $(free -m | awk '$1 ~ "M" {print $6}') / $mem_total))
    1.20  		mem_free=$((100 - mem_used - mem_buff))
    1.21  
    1.22  		cat <<EOT
    1.23 @@ -644,7 +644,6 @@
    1.24  
    1.25  free -m | awk '
    1.26  $1 ~ "M" {print "<tr><td>"$1"</td><td>"$2"</td><td>"$3"</td><td>"$4"</td><td>"$5"</td><td>"$6"</td></tr>"}
    1.27 -$1 ~ "+" {print "<tr><td>"$1 $2"</td><td></td><td>"$3"</td><td>"$4"</td><td></td><td></td></tr>"}
    1.28  $1 ~ "S" {print "<tr><td>"$1"</td><td>"$2"</td><td>"$3"</td><td>"$4"</td><td></td><td></td></tr>"}'
    1.29  
    1.30  		cat <<EOT