3 # fancontrol Fans speed control according to temperature service
5 # Starts after all hotplug-like things, which could load proper drivers
6 # for fans and dies last possible
9 # description: It is crucial to proper configure this service, or severe
10 # damadge could occur. For this, be sure, to run init first
11 # and be sure the configuration is correct.
16 # - check this, case this is my first 'advanced' init script
17 # - maybe add some more stop control, like re-running fancontrol and killing
18 # it once more, if killproc fails
21 # Source function library
22 . /etc/rc.d/init.d/functions
25 [ -f /etc/sysconfig/fancontrol ] && . /etc/sysconfig/fancontrol
28 # sensors deamon needs to be started
29 # or at least proper modules loaded (provided by sensorsd deamon)
30 if [ -f /var/lock/subsys/sensors ]; then
31 # Check if the service is already running?
32 if [ ! -f /var/lock/subsys/fancontrol ]; then
33 # Fancontrol needs to check system for pwm control
34 if [ ! -f /etc/sysconfig/fancontrol ]; then
35 nls "Fancontrol not initialized."
36 nls "Try \`%s init' before start." "$0"
40 msg_starting fancontrol
41 # won't start without an output
42 daemon --fork 'fancontrol >/dev/null'
44 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fancontrol
46 msg_already_running fancontrol
49 echo "Start sensors daemon first"
55 if [ -f /var/lock/subsys/fancontrol ]; then
57 msg_stopping fancontrol
58 # it's crucial to be sure it ended ok, otherwise we get
59 # the fans set and the computer working without any control
60 # and that could cause MASSIVE damage
61 killproc --waitforname fancontrol --waitfortime 30 fancontrol -TERM
62 rm -f /var/lock/subsys/fancontrol
64 msg_not_running fancontrol
73 # See how we were called.
93 msg_usage "$0 {start|stop|restart|status|init}"
99 # This must be last line !