A script that monitors the CPU temperature of a Raspberry Pi and logs system information. If the temperature exceeds a specified threshold, the script logs information about open processes, CPU usage, current temperature, and system uptime, and then shuts down the Raspberry Pi to prevent overheating.
This mini project was started because I don't have a fan or a heatsink for my Raspberry Pi processor, and I don't want it to overheat.
-
Clone the repository:
git clone https://github.com/scoxfield/rpi-temp-monitor cd rpi-temp-monitor
-
Run the setup script:
sudo ./setup.sh
During the setup, you will be prompted to enter the interval (in seconds) at which the script checks the temperature. If not specified, the default is 60 seconds.
-
Run the temperature monitor script directly (optional):
If you prefer not to use the setup script, you can run the
temp_monitor.sh
script directly with a specified interval:./temp_monitor.sh <interval_in_seconds>
Replace
<interval_in_seconds>
with the wanted interval.
The temperature monitor service will automatically start on boot and check the temperature at the specified interval. If you need to change the interval, you can modify the service file or rerun the setup script with a new interval.
Run the uninstall script to remove the temperature monitor service:
sudo ./uninstall.sh