Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Instruction Guide Create a Simple Script to Get System Information
#2
Here is another variation, which displays the CPU speed in MHz, but requires you to use "sudo" when you run it:

Code:
#!/bin/bash
# Script: my-pi-temp.sh
# Purpose: Display the ARM CPU and GPU  temperature of Raspberry Pi 2/3
# Author: Vivek Gite <www.cyberciti.biz> under GPL v2.x+
# Edits by: Cogitech (add Core Volts and CPU Freq)
# -------------------------------------------------------
cpu=$(</sys/class/thermal/thermal_zone0/temp)
freq=$(</sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq)
echo "$(date) @ $(hostname)"
echo "-------------------------------------------"
echo "GPU temp   => $(vcgencmd measure_temp)"
echo "CPU temp   => $((cpu/1000))'C"
echo "Core Volts => $(vcgencmd measure_volts)"
echo "CPU Freq   => $((freq/1000)) MHz"


Displays this:


Code:
moode@moode:~ $ sudo ./my-pi-temp.sh
Wed Dec 20 17:36:49 MST 2023 @ moode
-------------------------------------------
GPU temp   => temp=45.7'C
CPU temp   => 45'C
Core Volts => volt=0.8600V
CPU Freq   => 1500 MHz
Reply


Messages In This Thread
RE: Create a Simple Script to Get System Information - by cogitech - 12-21-2023, 12:37 AM

Forum Jump: