blob: d674356162bf89d85d81c9b185c3020934e89670 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#!/bin/bash
# Maximum CPU temperature in degrees Celsius
MAX_TEMP=180
# Maximum time in seconds that the system can be frozen
MAX_FROZEN_TIME=300
# Check the CPU temperature
TEMP=$(sensors | grep 'Core 0:' | awk '{print $3}' | cut -c2-3)
if [ $TEMP -ge $MAX_TEMP ]; then
echo "CPU temperature is too high. Rebooting..."
/sbin/reboot
fi
# Check if the system is frozen
LAST_LOAD=$(uptime | awk '{print $NF}')
if [ $LAST_LOAD -gt $MAX_FROZEN_TIME ]; then
echo "System is frozen. Rebooting..."
/sbin/reboot
fi
|