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
#1
I found this elsewhere and then modified it a bit to add more info.

Simply ssh into your moode and then

nano your_file_name.sh

and then paste this in it and save the changes:


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)
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   => $(sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq) KHz"


Then do:


Code:
chmod +x your_file_name.sh


To run the script, simply:


Code:
./your_file_name.sh


The output will look something like:

Code:
Wed Dec 20 17:18:46 MST 2023 @ moode
-------------------------------------------
GPU temp   => temp=45.7'C
CPU temp   => 46'C
Core Volts => volt=0.8600V
CPU Freq   => 700000 KHz


You can also do the following if you want to monitor this info while playing music, running tests (resampling, EQ, DSP, etc.)

Code:
watch ./your_file_name.sh
Reply
#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


Forum Jump: