]>
Commit | Line | Data |
---|---|---|
ca04aac1 | 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 | ||
2e25ba16 | 24 | start() { |
ca04aac1 | 25 | # Fancontrol needs to check system for pwm control |
26 | if [ ! -f /etc/sysconfig/fancontrol ]; then | |
27 | nls "Fancontrol not initialized." | |
28 | nls "Try \`%s init' before start." "$0" | |
29 | exit 6 | |
30 | fi | |
31 | # Check if the service is already running? | |
32 | if [ ! -f /var/lock/subsys/fancontrol ]; then | |
33 | msg_starting fancontrol | |
34 | daemon fancontrol | |
35 | RETVAL=$? | |
36 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fancontrol | |
37 | else | |
38 | msg_already_running fancontrol | |
39 | fi | |
2e25ba16 ER |
40 | } |
41 | ||
42 | stop() { | |
ca04aac1 | 43 | if [ -f /var/lock/subsys/fancontrol ]; then |
44 | # Stop daemons. | |
45 | msg_stopping fancontrol | |
46 | killproc fancontrol | |
47 | rm -f /var/lock/subsys/fancontrol | |
48 | else | |
49 | msg_not_running fancontrol | |
50 | fi | |
2e25ba16 ER |
51 | } |
52 | ||
53 | restart() { | |
54 | stop | |
55 | start | |
56 | } | |
57 | ||
58 | # See how we were called. | |
59 | case "$1" in | |
60 | start) | |
61 | start | |
62 | ;; | |
63 | stop) | |
64 | stop | |
ca04aac1 | 65 | ;; |
66 | restart) | |
2e25ba16 | 67 | restart |
ca04aac1 | 68 | ;; |
69 | reload) | |
70 | if [ -f /var/lock/subsys/fancontrol ]; then | |
71 | msg_reloading fancontrol | |
72 | killproc fancontrol -HUP | |
73 | RETVAL=$? | |
74 | else | |
75 | msg_not_running fancontrol >&2 | |
76 | RETVAL=7 | |
77 | fi | |
78 | ;; | |
79 | force-reload) | |
2e25ba16 | 80 | restart |
ca04aac1 | 81 | ;; |
82 | init) | |
83 | pwmconfig | |
84 | exit $? | |
85 | ;; | |
86 | status) | |
87 | status fancontrol | |
88 | RETVAL=$? | |
89 | ;; | |
90 | *) | |
91 | msg_usage "$0 {start|stop|restart|reload|force-reload|status|init}" | |
92 | exit 3 | |
93 | esac | |
94 | ||
95 | exit $RETVAL | |
96 | ||
97 | # This must be last line ! | |
98 | # vi:syntax=sh |