Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save siberex/22b37f8d184e3621399f64f3a13ae3a5 to your computer and use it in GitHub Desktop.
Save siberex/22b37f8d184e3621399f64f3a13ae3a5 to your computer and use it in GitHub Desktop.
real-time-temperature-output-coral-ai-pcie-accelerators
#!/bin/bash
# Main loop to continuously monitor the temperature
while true; do
clear
echo "Monitoring Coral PCIe Accelerators Temperature"
# Dynamically find all apex devices and read their temperatures
for device_path in /sys/class/apex/apex_*; do
if [ -f "$device_path/temp" ]; then
device_name=$(basename "$device_path")
temp_milli_c=$(cat "$device_path/temp")
temp_c=$(echo "scale=1; $temp_milli_c / 1000" | bc)
echo "$device_name: $temp_c °C"
else
echo "$device_name: Temperature readout not available"
fi
done
# Wait for a second before the next update
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment