From 9a65f5927327452bdadee519191142db8f3fa16a Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Mon, 3 Oct 2022 22:25:53 +0100 Subject: [PATCH] Split some long lines in system-info-WSL.sh --- system-info/system-info-WSL.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/system-info/system-info-WSL.sh b/system-info/system-info-WSL.sh index 7a2d247..ca476de 100755 --- a/system-info/system-info-WSL.sh +++ b/system-info/system-info-WSL.sh @@ -19,14 +19,16 @@ fi while true; do # Assumes OpenHardwareMonitor is running and emitting data to WMI so we can # access it via the Windows hosts powershell.exe. - raw_cpu_temp=$(powershell.exe -NoProfile "(Get-WmiObject -Namespace \"root/OpenHardwareMonitor\" -Query 'select Value from Sensor WHERE Identifier LIKE \"$cpu_temp_sensor\"').Value" | sed 's/\r//') + raw_cpu_temp=$(powershell.exe -NoProfile \ + "(Get-WmiObject -Namespace \"root/OpenHardwareMonitor\" -Query 'select Value from Sensor WHERE Identifier LIKE \"$cpu_temp_sensor\"').Value" \ + | sed 's/\r//') cpu_temp=$(printf "%.1f°C" "$raw_cpu_temp") - cpu_load=`mpstat -P ALL -n 1 -u 1 -o JSON | \ + cpu_load=" `mpstat -P ALL -n 1 -u 1 -o JSON | \ jq '.sysstat.hosts[0].statistics[0]["cpu-load"][1:]|.[].idle' | \ - awk '$idle ~ /[-.0-9]*/ { printf "%s", substr("█▇▆▅▄▃▂▁ ", int($idle / 11), 1) }'` + awk '$idle ~ /[-.0-9]*/ { printf "%s", substr("█▇▆▅▄▃▂▁ ", int($idle / 11), 1) }'`" - echo "$cpu_temp $cpu_load" > $cache_file + echo "$cpu_temp$cpu_load" > $cache_file # echo -e "HTTP/1.1 200 OK\n\n$cpu_temp $cpu_load" | nc -l -k -p 8080 -q 1; sleep 2 done