]> git.nbdom.net Git - nb.git/commitdiff
etc/profile.d/sys.sh
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 12 May 2019 22:23:45 +0000 (23:23 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 12 May 2019 22:23:45 +0000 (23:23 +0100)
etc/profile.d/sys.sh

index 6eb0a90885cba772693cb36506f9ea57260c7399..b7c15a9f3b19cb09f02dccd5c6705eaee8bca2f1 100644 (file)
@@ -228,6 +228,12 @@ sys_cpu_load() {
 }
 
 sys_cpu_temperature() {
-  awk '{printf("%.1f\n",$1/1000)}' /sys/class/thermal/thermal_zone*/temp
+  (
+       # Mac
+       cat /sys/devices/platform/coretemp.*/hwmon/hwmon*/temp*_max \
+       # Others
+       || cat /sys/class/thermal/thermal_zone*/temp
+  ) | awk '/^[0-9]/ {printf("%.1f\n",$1/1000)}'
+  #awk '{printf("%.1f\n",$1/1000)}' /sys/class/thermal/thermal_zone*/temp
   #awk '{ count++; sum+=$1 } END {printf("%.1f",sum/count/1000)}' /sys/class/thermal/thermal_zone*/temp
 }