]> git.pld-linux.org Git - packages/lm_sensors.git/blame - fancontrol.init
- do not use macro for /etc/sysconfig
[packages/lm_sensors.git] / fancontrol.init
CommitLineData
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
ca5b4a01
ER
21# Get service config
22 [ -f /etc/sysconfig/fancontrol ] && . /etc/sysconfig/fancontrol
ca04aac1 23
2e25ba16 24start() {
ca04aac1 25 # Check if the service is already running?
26 if [ ! -f /var/lock/subsys/fancontrol ]; then
ca5b4a01
ER
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
ca04aac1 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
2e25ba16
ER
41}
42
43stop() {
ca04aac1 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
2e25ba16
ER
52}
53
54restart() {
55 stop
56 start
57}
58
59# See how we were called.
60case "$1" in
61 start)
62 start
63 ;;
64 stop)
65 stop
ca04aac1 66 ;;
67 restart)
2e25ba16 68 restart
ca04aac1 69 ;;
70 reload)
71 if [ -f /var/lock/subsys/fancontrol ]; then
72 msg_reloading fancontrol
73 killproc fancontrol -HUP
74 RETVAL=$?
75 else
ca5b4a01 76 msg_not_running fancontrol
ca04aac1 77 RETVAL=7
78 fi
79 ;;
80 force-reload)
2e25ba16 81 restart
ca04aac1 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
94esac
95
96exit $RETVAL
97
98# This must be last line !
99# vi:syntax=sh
This page took 0.071185 seconds and 4 git commands to generate.