Here are a couple of BASH scripts to display the temperature of the BCM2835 SoC used on the Raspberry PI. Using this its fairly simple to create a temperature logging system or even going a step further and if the temperature exceeded a maximum you could shutdown your system.
Here are a couple of simple scripts, open the terminal and enter the following
Both are similar but the second adds a 1 second delay between readings
#!/bin/bash
for i in {1..10}
do
/opt/vc/bin/vcgencmd measure_temp
done
Example 2
#!/bin/bash
for i in {1..10}
do
/opt/vc/bin/vcgencmd measure_temp
sleep 1
done