]> git.pld-linux.org Git - packages/lm_sensors.git/blob - fancontrol.init
cfefcc5381d438c552e57e09c195a0358a0336d0
[packages/lm_sensors.git] / fancontrol.init
1 #!/bin/sh
2 #
3 # fancontrol    fancontrol short service description
4 #
5 # chkconfig:    345 <start_level> <stop_level>
6 #
7 # description:  fancontrol long service description
8 #
9 # $Id$
10 #
11 # TODO:
12 # - find out, if it should be dependant of sensors deamon
13 # - check this, case this is my first 'advanced' init script
14 # - register proper start and stop levels
15 # - describe that
16 #
17
18 # Source function library
19 . /etc/rc.d/init.d/functions
20
21 # Get service config - may override defaults
22 # [ -f /etc/sysconfig/fancontrol ] && . /etc/sysconfig/fancontrol
23
24 # See how we were called.
25 case "$1" in
26   start)
27         # Fancontrol needs to check system for pwm control
28         if [ ! -f /etc/sysconfig/fancontrol ]; then
29                 nls "Fancontrol not initialized."
30                 nls "Try \`%s init' before start." "$0"
31                 exit 6
32         fi
33         # Check if the service is already running?
34         if [ ! -f /var/lock/subsys/fancontrol ]; then
35                 msg_starting fancontrol
36                 daemon fancontrol
37                 RETVAL=$?
38                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fancontrol
39         else
40                 msg_already_running fancontrol
41         fi
42         ;;
43   stop)
44         if [ -f /var/lock/subsys/fancontrol ]; then
45                 # Stop daemons.
46                 msg_stopping fancontrol
47                 killproc fancontrol
48                 rm -f /var/lock/subsys/fancontrol
49         else
50                 msg_not_running fancontrol
51         fi
52         ;;
53   restart)
54         $0 stop
55         $0 start
56         exit $?
57         ;;
58   reload)
59         if [ -f /var/lock/subsys/fancontrol ]; then
60                 msg_reloading fancontrol
61                 killproc fancontrol -HUP
62                 RETVAL=$?
63         else
64                 msg_not_running fancontrol >&2
65                 RETVAL=7
66         fi
67         ;;
68   force-reload)
69         # if program allows reloading without stopping
70         $0 reload
71
72         # or if it doesn't
73         $0 restart
74
75         exit $?
76         ;;
77   init)
78         pwmconfig
79         exit $?
80         ;;
81   status)
82         status fancontrol
83         RETVAL=$?
84         ;;
85   *)
86         msg_usage "$0 {start|stop|restart|reload|force-reload|status|init}"
87         exit 3
88 esac
89
90 exit $RETVAL
91
92 # This must be last line !
93 # vi:syntax=sh
This page took 0.043845 seconds and 2 git commands to generate.