Search
j0ke.net Open Build Service
>
Projects
>
stresslinux
>
sensors
> lm_sensors.init
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File lm_sensors.init of Package sensors
#!/bin/sh # ### BEGIN INIT INFO # Provides: lm_sensors # Required-Start: $remote_fs # Required-Stop: $remote_fs # Default-Start: 2 3 5 # Default-Stop: # Short-Description: Load and configure hardware monitoring drivers # Description: sensors is used for monitoring motherboard sensor values. # Config file is /etc/sysconfig/lm_sensors ### END INIT INFO # # 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., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301 USA. # See also the lm_sensors homepage at: # http://www.lm-sensors.org # It uses a config file /etc/sysconfig/lm_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. CONFIG=/etc/sysconfig/lm_sensors LOCK=/var/lock/subsys/lm_sensors PSENSORS=/usr/bin/sensors FANCONFIG=/etc/fancontrol PFAN=/usr/sbin/fancontrol # Source function library. . /etc/rc.status start() { echo -n "Starting up sensors" unset ${!MODULE_*} test -r "$CONFIG" && . "$CONFIG" for i in ${!MODULE_*} ; do eval module=\$$i /sbin/modprobe $module &>/dev/null rc_status done rc_status /usr/bin/sensors -s &> /dev/null rc_status # Start fan control, if configured if test -s "$FANCONFIG" -a -x "$PFAN" ; then echo -n ", starting fan control: " /sbin/startproc -q "$PFAN" rc_status else echo -n ": " fi rc_status -v && touch $LOCK } stop() { echo -n "Shutting down sensors" unset ${!MODULE_*} test -r "$CONFIG" && . "$CONFIG" # Stop fan control, if it was started if test -s /var/run/fancontrol.pid ; then echo -n ", stopping fan control: " /sbin/killproc -TERM "$PFAN" rc_status else echo -n ": " fi for i in ${!MODULE_*} ; do eval module=\$$i /sbin/modprobe -r $module &>/dev/null rc_status done rc_status -v && rm -f $LOCK } dostatus() { $PSENSORS rc_status } restart() { stop start rc_status } condrestart() { [ -e $LOCK ] && restart || : } # Reset status of this service rc_reset # See how we were called. case "$1" in start) start ;; stop) stop ;; status) dostatus ;; restart|reload) restart ;; try-restart) condrestart ;; *) echo "Usage: lm_sensors {start|stop|status|restart|reload|try-restart}" exit 1 esac rc_exit