]> git.pld-linux.org Git - packages/lm_sensors.git/commitdiff
- initial revision
authorpascalek <pascalek@pld-linux.org>
Wed, 15 Nov 2006 15:33:17 +0000 (15:33 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    sensors.sh -> 1.1
    sensors_modules.init -> 1.1
    sensors_modules.sysconfig -> 1.1

sensors.sh [new file with mode: 0644]
sensors_modules.init [new file with mode: 0644]
sensors_modules.sysconfig [new file with mode: 0644]

diff --git a/sensors.sh b/sensors.sh
new file mode 100644 (file)
index 0000000..9327963
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+TOPLEFT=`tput cup 0 0`
+NORMAL=`tput sgr0`
+RED=`tput setaf 1`
+GREEN=`tput setaf 2`
+BROWN=`tput setaf 3`
+BLUE=`tput setaf 4`
+MAGENTA=`tput setaf 5`
+CYAN=`tput setaf 6`
+WHITE=`tput setaf 7`
+BOLD=`tput bold`
+
+clear
+while true
+do
+
+       IFS=""
+       echo -ne "$TOPLEFT$NORMAL"
+
+       COLS=`tput cols`        
+       FORMAT="%-"$COLS"s\\n"
+       echo "Press Ctrl+C to exit" | awk "{ printf(\"$FORMAT\", \$0) }"
+       echo -ne `/usr/bin/sensors | 
+               awk "{ printf(\"$FORMAT\", \\$0) }" | 
+               sed -r "s/( +[ +.0-9-]+) V(.*)/$BOLD$CYAN\1$NORMAL$CYAN V$NORMAL\2/g" |
+               sed -r "s/( +[ +.0-9-]+) RPM(.*)/$BOLD$CYAN\1$NORMAL$CYAN RPM$NORMAL\2/g" |
+               sed -r "s/( +[ +.0-9-]+)°C(.*)/$BOLD$CYAN\1$NORMAL$CYAN°C$NORMAL\2/g" |
+
+               sed -r "s/= ([ +.0-9-]+)([VRPM°C]*)([,\)])/= $BOLD$GREEN\1$NORMAL$GREEN\2$NORMAL\3/g" |
+               sed -r "s/sensor = (.*$)/sensor = $GREEN\1$NORMAL/g" |
+
+               sed -r "s/^(.*):/$BOLD$BROWN\1$NORMAL:/g" |
+               sed -r "s:(ALARM):$BOLD$RED\1$NORMAL:g"
+       `
+
+       sleep 1s
+done
diff --git a/sensors_modules.init b/sensors_modules.init
new file mode 100644 (file)
index 0000000..f3b10a4
--- /dev/null
@@ -0,0 +1,77 @@
+#!/bin/sh
+#
+# sensors_modules:     Hardware sensors monitoring
+#
+# Version:     $Revision$
+#
+# chkconfig:   2345 31 69
+# description: Loads and removes hardware sensors modules
+# author:      Filip Kalinski <filon@pld.org.pl>
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+# Get service config
+if [ -f /etc/sysconfig/sensors_modules ]; then
+       . /etc/sysconfig/sensors_modules
+fi
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       # Check if the service is already running?
+       if [ ! -f /var/lock/subsys/sensors_modules ]; then
+               if [ -z "$BUS" ] || [ -z "$CHIP" ]; then
+                       msg_starting "sensors modules"; fail
+                       nls "BUS or CHIP not configured in /etc/sysconfig/sensors_modules" >&2
+                       exit 6
+               fi
+
+               # insert modules
+               for i in $BUS; do
+                       _modprobe single die "i2c-$i"
+               done
+               for i in $CHIP; do
+                       _modprobe single die "$i"
+               done
+
+               if [ "$SENSORS_SET" = "1" ]; then
+                       sensors -s
+               fi
+               touch /var/lock/subsys/sensors_modules
+       else
+               msg_already_running "sensors modules"
+       fi
+       ;;
+  stop)
+       if [ -f /var/lock/subsys/sensors_modules ]; then
+               msg_stopping "sensors modules"
+
+               # remove kernel modules
+               for i in $CHIP; do
+                       /sbin/rmmod $i >/dev/null 2>&1
+               done
+               for i in $BUS; do
+                       /sbin/rmmod i2c-$BUS >/dev/null 2>&1
+               done
+               ok
+               rm -f /var/lock/subsys/sensors_modules
+       else
+               msg_not_running "sensors modules"
+       fi
+       ;;
+  status)
+       sensors
+       ;;
+  restart|force-reload)
+       $0 stop
+       $0 start
+       exit $?
+       ;;
+  *)
+       msg_usage "$0 {start|stop|restart|force-reload|status}"
+       exit 3
+esac
+
+exit $RETVAL
diff --git a/sensors_modules.sysconfig b/sensors_modules.sysconfig
new file mode 100644 (file)
index 0000000..0a56db1
--- /dev/null
@@ -0,0 +1,23 @@
+# configuration for harware sensors monitoring
+
+# configure sensors (i.e. call `sensors -s')
+# Allows to change min and max alarm limits from sensors.conf
+#SENSORS_SET=1
+
+# BUS - stands for i2c bus, one of: ali1535, ali15x3, amd756, hydra, i801,
+#      i810, isa, piix4, savage4, sis5595, via, viapro, voodoo3
+
+BUS=
+
+# CHIP - stands for sensors chip, one of: adm1021, adm1024, adm1025,
+#      adm9240, bt869, ddcmon, ds1621, eeprom fscpos, fscscy, gl518sm,
+#      gl520sm, icspll, it87, lm75, lm78, lm80 lm87, ltc1710, matorb,
+#      maxilife, mtp008, pcf8574, sis5595, thmc50 via686a, vt1211, w83781d
+
+CHIP=
+
+# You may use sensors-detect commant to check what bus and chips are available
+
+# example for VIAKT* mainboards (bus is not (!) via)
+# BUS=isa
+# CHIP=via686a
This page took 0.09002 seconds and 4 git commands to generate.