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.
14 # - check this, case this is my first 'advanced' init script
15 # - maybe add some more stop control, like re-running fancontrol and killing
16 # it once more, if killproc fails
19 # Source function library
20 . /etc/rc.d/init.d/functions
23 [ -f /etc/sysconfig/fancontrol ] && . /etc/sysconfig/fancontrol
26 # sensors deamon needs to be started
27 # or at least proper modules loaded (provided by sensorsd deamon)
28 if [ ! -f /var/lock/subsys/sensord ]; then
29 echo "Start sensors daemon first"
34 # Check if the service is already running?
35 if [ -f /var/lock/subsys/fancontrol ]; then
36 msg_already_running fancontrol
40 # Fancontrol needs to check system for pwm control
41 if [ ! -f /etc/sysconfig/fancontrol ]; then
42 nls "Fancontrol not initialized."
43 nls "Try \`%s init' before start." "$0"
47 msg_starting fancontrol
48 # won't start without an output
49 daemon --fork --redirfds /usr/sbin/fancontrol
51 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fancontrol
55 if [ ! -f /var/lock/subsys/fancontrol ]; then
56 msg_not_running fancontrol
61 msg_stopping fancontrol
62 # it's crucial to be sure it ended ok, otherwise we get
63 # the fans set and the computer working without any control
64 # and that could cause MASSIVE damage
65 killproc --waitforname fancontrol --waitfortime 30 fancontrol -TERM
66 rm -f /var/lock/subsys/fancontrol
74 # See how we were called.
94 msg_usage "$0 {start|stop|restart|init|status}"