OK, here comes the second revision o removed bashisms - make proper redirects to /dev/null - no bash-i18n o no attempt to start lm_sensors is no config file or no modules in the config file o removed leading and trailing underscores of displayed module names o no /dev manipulation, it's not really part of an init script to create device nodes. -- Axel.Thimm at ATrpms.net -------------- next part -------------- Index: prog/init/lm_sensors.init =================================================================== RCS file: /home/cvs/lm_sensors2/prog/init/lm_sensors.init,v retrieving revision 1.6 diff -u -d -u -d -r1.6 lm_sensors.init --- prog/init/lm_sensors.init 27 Nov 2004 04:24:41 -0000 1.6 +++ prog/init/lm_sensors.init 13 Dec 2004 10:37:33 -0000 @@ -36,17 +36,23 @@ 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 + [ -e /proc/sys/dev/sensors ] || /sbin/modprobe i2c-proc >/dev/null 2>&1 # 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 + [ -e /var/lock/subsys/lm_sensors ] || /sbin/modprobe -r i2c-proc >/dev/null 2>&1 fi CONFIG=/etc/sysconfig/lm_sensors +[ -r "$CONFIG" ] || exit 0 +grep '^MODULE_' $CONFIG >/dev/null 2>&1 || exit 0 + +# Load config file +. "$CONFIG" + PSENSORS=/usr/local/bin/sensors if [ ! -x $PSENSORS ]; then @@ -57,17 +63,17 @@ . /etc/init.d/functions RETVAL=0 +prog="lm_sensors" start() { - echo -n $"Starting up sensors: " - test -r "$CONFIG" && . "$CONFIG" + echo -n "Starting $prog: loading module " 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 + echo -n "${module} " + /sbin/modprobe $module >/dev/null 2>&1 i=`expr $i + 1` done $PSENSORS -s @@ -83,19 +89,18 @@ } stop() { - echo -n $"Shutting down sensors: " - test -r "$CONFIG" && . "$CONFIG" + echo -n "Stopping $prog: " 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 + /sbin/modprobe -r $module >/dev/null 2>&1 i=`expr $i - 1` done if [ $WITHSYS == "0" ]; then - /sbin/modprobe -r i2c-proc &>/dev/null + /sbin/modprobe -r i2c-proc >/dev/null 2>&1 fi RETVAL=$? @@ -141,7 +146,7 @@ condrestart ;; *) - echo "Usage: sensors.init {start|stop|status|restart|reload|condrestart}" + echo "Usage: $0 {start|stop|status|restart|reload|condrestart}" exit 1 esac -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20041213/eaa1ee77/attachment.bin