#!/bin/bash # SARPi Project - Slackware Linux on a Raspberry Pi [sarpi.penthux.net] # # cpu_status.sh # # Raspberry Pi CPU clock frequency and thermal status. # This script outputs the current status of the CPU clock speed (MHz) # and core temperature (Celsius) for monitoring or testing purposes # while under load or idle. Easily modified to suit other ARM devices. # # Usage - # Default command: ./cpu_status.sh # run once, no refresh # Default refresh: watch ./cpu_status.sh # 2 seconds refresh # Custom refresh: watch -n ./cpu_status.sh # With highlights: watch -d -n0 ./cpu_status.sh # Perm highlights: watch -d=cumulative -n0 ./cpu_status.sh # # Exaga : 15 Jan 2018 - progenitor # 29 Jun 2019 - update rpi model & hw revision # 03 Jul 2019 - update quad-core cpu and system uptime # 18 Jul 2019 - update cpu-id and cpufreq-info # 27 Jan 2020 - code revision and update # 07 Sep 2020 - code clean-up # 16 Mar 2026 - code revision to auto discover cores # set -u IFS=$'\n\t' # Output SARPi marque echo -e "SARPi Project - sarpi.penthux.net\nSlackware $(uname -m) SoC [MHz & Thermal] Stats\n" # Get RPi model, hardware revision, and CPU RPiModel=$(tr -d '\0' /dev/null 2>&1; then echo cpufreq-info | grep -m1 'cpufreq stats:' | cut -d'(' -f1 | cut -d' ' -f3-12 echo fi # CPU thermal status echo "CPU Thermal Status" cpuTemp=$(