Skip to contentSkip to conversation

sensors help

lm-sensors jounin F 2 participants 2 messages Dec 10, 2007

lore
Share & tools
lore

jounin F

author
#0 lore raw

Hi guys,
Anybody out there know how I can output only the motherboard and cpu temperature when I issue the command 'sensors'?
I need to log the temperature reading outputted by sensors, but I only want the temperature for my mobo and my cpu. That way, the log file won't be too large even if I collect temperature readings for days.

Thanks!

Signature · 2 lines
Francis
Counted as Linux user no. #454073

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#1 lore raw
Quoted 8 lines · jounin F

Hi guys,
Anybody out there know how I can output only the motherboard and cpu temperature when I issue the command 'sensors'?
I need to log the temperature reading outputted by sensors, but I only want the temperature for my mobo and my cpu. That way, the log file won't be too large even if I collect temperature readings for days.

Thanks!

$ sensors | grep Temp
CPU Temp:    +33°C  (low  =  +127°C, high =  +127°C)   sensor = thermistor
SYS Temp:    +13°C  (low  =  +127°C, high =   +60°C)   sensor = diode
$ sensors | grep Temp >> sensors.txt
$ cat sensors.txt
CPU Temp:    +33°C  (low  =  +127°C, high =  +127°C)   sensor = thermistor
SYS Temp:    +12°C  (low  =  +127°C, high =   +60°C)   sensor = diode

Now you probably want to make a little script file with the command you will use in it using the full path to the file and run it via a cron job at whatever interval you want the data collected. A line this in your crontab (use crontab -e to edit then save it) should run a script file every minute.

*/1 * * * * /home/stephen/archives/bin/sensor_log.sh >/dev/null 2&>1

With maybe this for the sensor_log.sh having used chmod +x sensor_log.sh on the file after creating it.

#!/bin/sh
sensors | grep Temp >> /home/stephen/archives/log/sensors.log

Of course changing to your paths and the string you are greping for and if you want to get rid of the excess on the end of the lines assuming the output appears like mine above then use this for the grep part of the command.

$ sensors | grep Temp | cut -d"(" -f1
CPU Temp:    +34°C
SYS Temp:    +14°C
$ sensors | grep Temp | cut -d"(" -f1 >> sensors.txt
$ cat sensors.txt
CPU Temp:    +33°C  (low  =  +127°C, high =  +127°C)   sensor = thermistor
SYS Temp:    +12°C  (low  =  +127°C, high =   +60°C)   sensor = diode
CPU Temp:    +34°C
SYS Temp:    +14°C

Stephen

Signature · 6 lines
GPG Public Key: http://users.eastlink.ca/~stephencormier/publickey.asc

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors