There are a few ways to do it, but the easiest is to run the 'sensors' command from the lm_sensors package, but I prefer the simplicity of the acpi command
For example,
[fedora ~]$ acpi -t
Thermal 0: ok, 20.0 degrees C
So you could do:
#!/usr/bin/bash
if [ $(acpi -t | cut -d" " -f4 | cut -d"." -f1) -gt 80 ]; then
# halt? shutdown? reboot? It's up to you.
fi
The second way is to use your BIOS settings to see if you can adjust the trip temperature. On my system,