]> git.pld-linux.org Git - packages/lm_sensors.git/blob - fancontrol.init
- i think this is correct
[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
22  [ -f /etc/sysconfig/fancontrol ] && . /etc/sysconfig/fancontrol
23
24 start() {
25         # Check if the service is already running?
26         if [ ! -f /var/lock/subsys/fancontrol ]; then
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
34                 msg_starting fancontrol
35                 daemon fancontrol
36                 RETVAL=$?
37                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fancontrol
38         else
39                 msg_already_running fancontrol
40         fi
41 }
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
54 restart() {
55         stop
56         start
57 }
58
59 # See how we were called.
60 case "$1" in
61   start)
62         start
63         ;;
64   stop)
65         stop
66         ;;
67   restart)
68         restart
69         ;;
70   reload)
71         if [ -f /var/lock/subsys/fancontrol ]; then
72                 msg_reloading fancontrol
73                 killproc fancontrol -HUP
74                 RETVAL=$?
75         else
76                 msg_not_running fancontrol
77                 RETVAL=7
78         fi
79         ;;
80   force-reload)
81         restart
82         ;;
83   init)
84         pwmconfig
85         exit $?
86         ;;
87   status)
88         status fancontrol
89         RETVAL=$?
90         ;;
91   *)
92         msg_usage "$0 {start|stop|restart|reload|force-reload|status|init}"
93         exit 3
94 esac
95
96 exit $RETVAL
97
98 # This must be last line !
99 # vi:syntax=sh
This page took 0.104603 seconds and 4 git commands to generate.