Use thermal zone x86_pkg_temp by default
authorSiraaj Khandkar <siraaj@khandkar.net>
Wed, 4 Mar 2020 22:30:00 +0000 (17:30 -0500)
committerSiraaj Khandkar <siraaj@khandkar.net>
Wed, 4 Mar 2020 22:30:00 +0000 (17:30 -0500)
x2/src/bash/exe/khatus.sh

index 438828d..10ddceb 100644 (file)
@@ -85,6 +85,19 @@ fork_poller() {
     done &
 }
 
     done &
 }
 
+find_thermal_zone() {
+    local -r _type="$1"
+    awk \
+        -v _type="$_type" \
+        '
+        $0 ~ ("^" _type "$") {
+            split(FILENAME, f, "thermal_zone");
+            split(f[2], f2, "/");
+            print f2[1]}
+        ' \
+        /sys/class/thermal/thermal_zone*/type
+}
+
 main() {
     declare -A opts=(
         ["--node"]=$(hostname)
 main() {
     declare -A opts=(
         ["--node"]=$(hostname)
@@ -96,7 +109,7 @@ main() {
         ["--wifi_interface"]=''
         ["--disk_space_device"]='/'
         ["--disk_io_device"]='sda'
         ["--wifi_interface"]=''
         ["--disk_space_device"]='/'
         ["--disk_io_device"]='sda'
-        ["--thermal_zone"]=0
+        ["--thermal_zone"]="$(find_thermal_zone x86_pkg_temp)"
         ["--fan_path"]='/proc/acpi/ibm/fan'
         ["--pulseaudio_sink"]='0'
         ["--interval_datetime"]=1
         ["--fan_path"]='/proc/acpi/ibm/fan'
         ["--pulseaudio_sink"]='0'
         ["--interval_datetime"]=1
This page took 0.024238 seconds and 4 git commands to generate.