Compare commits

..

No commits in common. "2bb99ee369ed26bf9584f3d8961718e5265871d2" and "fa263fb95e398f9f3eb12e9c449c8ea14fec1b2b" have entirely different histories.

View File

@ -19,21 +19,14 @@ fi
while true; do while true; do
# Assumes OpenHardwareMonitor is running and emitting data to WMI so we can # Assumes OpenHardwareMonitor is running and emitting data to WMI so we can
# access it via the Windows hosts powershell.exe. # access it via the Windows hosts powershell.exe.
raw_cpu_temp=$(powershell.exe -NoProfile \ 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//')
"(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_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' | \ 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) }'`
raw_battery=$(powershell.exe -NoProfile \ echo "$cpu_temp $cpu_load" > $cache_file
"(Get-WmiObject win32_battery).EstimatedChargeRemaining" \
| sed 's/\r//')
battery=$(printf "%3d%%" "$raw_battery")
echo "$cpu_temp$cpu_load$battery" > $cache_file
# echo -e "HTTP/1.1 200 OK\n\n$cpu_temp $cpu_load" | nc -l -k -p 8080 -q 1; # echo -e "HTTP/1.1 200 OK\n\n$cpu_temp $cpu_load" | nc -l -k -p 8080 -q 1;
sleep 2 sleep 2
done done