Archlinux'de lm sensors nasıl?
From Lapis Wiki
Bu makale NASIL bölümü serisinin bir parçasıdır
|
| MasaÜstü • Donanım • Ağ • Dağıtımlar |
| Tarayıcılar• Programlama • Linux ve Oyunlar |
Lm_sensors donanımımızda ki çeşitli(cpu ısısı, anakart ısısı, sistem voltajı, vs.) ölçümleri almak için yazılmış bir uygulamadır. i2c kernel modülünü kullanmaktadır.
Lm_sensors uygulamasını pacman kullanarak yüklüyoruz.
pacman -S lm_sensors
Yükleme işlemi tamamlanınca lm_sensors'u ayarlamak için
modprobe i2c-dev
sensors-detect
ile /etc/sysconfig/lm_sensors dosyasını oluşturuyoruz. Eğer i2c modulu kernel'e yuklu değilse soracaktır. /etc/sysconfig/lm_sensors dosyasının içeriği aşağıdaki gibi olacaktır.
MODULE_0=i2c-nforce2 MODULE_1=i2c-isa MODULE_2=eeprom MODULE_3=w83627hf
Aşağıdaki kodları /etc/rc.d/lm_sensors olarak kaydedin
#!/bin/sh
#
# chkconfig: 2345 26 74
# description: sensors is used for monitoring motherboard sensor values.
# config: /etc/sysconfig/sensors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# See also the lm_sensors homepage at:
# http://www2.lm-sensors.nu/~lm78/index.html
# It uses a config file /etc/sysconfig/sensors that contains the modules to
# be loaded/unloaded. That file is sourced into this one.
# The format of that file a shell script that simply defines the modules
# in order as normal shell variables with the special names:
# MODULE_1, MODULE_2, MODULE_3, etc.
if grep -q sysfs /proc/mounts; then
WITHSYS=1
else
WITHSYS=0
fi
if [ $WITHSYS == "0" ]; then
# If sensors isn't supported by the kernel, try loading the module...
[ -e /proc/sys/dev/sensors ] || /sbin/modprobe i2c-proc &>/dev/null
# Don't bother if /proc/sensors still doesn't exist, kernel doesn't have
# support for sensors.
[ -e /proc/sys/dev/sensors ] || exit 0
# If sensors was not already running, unload the module...
[ -e /var/lock/subsys/lm_sensors ] || /sbin/modprobe -r i2c-proc &>/dev/null
fi
CONFIG=/etc/sysconfig/lm_sensors
PSENSORS=/usr/local/bin/sensors
if [ ! -x $PSENSORS ]; then
PSENSORS=/usr/bin/sensors
fi
# Source function library.
. /etc/rc.d/functions
RETVAL=0
start() {
echo -n $"Starting up sensors: "
test -r "$CONFIG" && . "$CONFIG"
modules=`grep \^MODULE_ $CONFIG | wc -l | tr -d ' '`
i=0
while [ $i -lt $modules ] ; do
module=`eval echo '$'MODULE_$i`
echo starting module __${module}__
/sbin/modprobe $module &>/dev/null
i=`expr $i + 1`
done
$PSENSORS -s
RETVAL=$?
if [ $RETVAL -eq 0 ] && touch /var/lock/subsys/lm_sensors ; then
stat_done
echo
else
stat_fail
echo
fi
}
stop() {
echo -n $"Shutting down sensors: "
test -r "$CONFIG" && . "$CONFIG"
modules=`grep \^MODULE_ $CONFIG | wc -l | tr -d ' '`
i=`expr $modules`
while [ $i -ge 0 ] ; do
module=`eval echo '$'MODULE_$i`
/sbin/modprobe -r $module &>/dev/null
i=`expr $i - 1`
done
if [ $WITHSYS == "0" ]; then
/sbin/modprobe -r i2c-proc &>/dev/null
fi
RETVAL=$?
if [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/lm_sensors ; then
stat_done
echo
else
stat_fail
echo
fi
}
dostatus() {
$PSENSORS
RETVAL=$?
}
restart() {
stop
start
RETVAL=$?
}
condrestart() {
[ -e /var/lock/subsys/lm_sensors ] && restart || :
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
dostatus
;;
restart|reload)
restart
;;
condrestart)
condrestart
;;
*)
echo "Usage: sensors.init {start|stop|status|restart|reload|condrestart}"
exit 1
esac
exit $RETVAL
Hizmet çalıştığı zaman durumunu anlayabileceği dosyayı oluşturabilmesi için
mkdir /var/lock/subsys
Şimdi hizmeti başlatabiliriz
/etc/rc.d/lm_sensors start
Şimdi de durumu görelim
sensors
Çıktısı aşağıdaki gibi
w83627hf-isa-0290
Adapter: ISA adapter
VCore 1: +1.65 V (min = +1.57 V, max = +1.73 V) ALARM
VCore 2: +1.68 V (min = +1.57 V, max = +1.73 V)
+3.3V: +3.23 V (min = +3.14 V, max = +3.47 V) ALARM
+5V: +5.03 V (min = +4.76 V, max = +5.24 V)
+12V: +11.98 V (min = +10.82 V, max = +13.19 V)
-12V: -12.11 V (min = -13.18 V, max = -10.80 V)
-5V: -5.25 V (min = -5.25 V, max = -4.75 V) ALARM
V5SB: +5.59 V (min = +4.76 V, max = +5.24 V)
VBat: +3.01 V (min = +2.40 V, max = +3.60 V)
fan1: 0 RPM (min = 675000 RPM, div = 2)
fan2: 3082 RPM (min = -1 RPM, div = 2)
fan3: 0 RPM (min = -1 RPM, div = 4)
temp1: +35°C (high = +32°C, hyst = +0°C) sensor = thermistor
temp2: +55.0°C (high = +66°C, hyst = +61°C) sensor = thermistor
temp3: +40.5°C (high = +66°C, hyst = +61°C) sensor = thermistor
vid: +1.650 V (VRM Version 9.0)
alarms:
beep_enable:
Sound alarm disabled
Her sistem açıldığında çalışabilmesi için /etc/rc.conf dosyasına ekliyoruz
DAEMONS=(syslog-ng hotplug !pcmcia network netfs crond lm_sensors cups)
