Debian Codegraph @

prog/init/fancontrol.init

raw
1 #!/bin/sh
2 #
3 # fancontrol
4 #
5 # chkconfig: 2345 90 01
6 # description: start/stop fancontrol
7 # pidfile: /var/run/fancontrol.pid
8 #
9
10 PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
11 export PATH
12
13 # Source function library.
14 . /etc/rc.d/init.d/functions
15
16 FANCONTROL="/usr/local/sbin/fancontrol"
17 PIDFILE="/var/run/fancontrol.pid"
18
19 RETVAL=0
20
21 start()
22 {
23 echo -n "Starting fancontrol daemon"
24 daemon $FANCONTROL -d
25 RETVAL=$?
26 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fancontrol
27 echo
28 }
29
30 stop()
31 {
32 echo -n "Stopping fancontrol daemon"
33 killproc $FANCONTROL
34 RETVAL=$?
35 rm -f /var/lock/subsys/fancontrol
36 echo
37 }
38
39 status()
40 {
41 if [ -f $PIDFILE ] ; then
42 pid=`cat $PIDFILE`
43 else
44 echo -n "$FANCONTROL does not appear to be running"
45 echo
46 exit
47 fi
48
49 if [ -n "$pid" ] ; then
50 ps -p $pid > /dev/null
51 if [ $? ] ; then
52 echo -n "$FANCONTROL appears to be running"
53 else
54 echo -n "$FANCONTROL does not appear to be running"
55 fi
56 echo
57 fi
58 }
59
60 condrestart()
61 {
62 [ -e /var/lock/subsys/fancontrol ] && restart || :
63 }
64
65 if [ ! -x $FANCONTROL ] ; then
66 echo "Cannot run $FANCONTROL"
67 exit 0
68 fi
69
70 case "$1" in
71 start)
72 start
73 ;;
74
75 stop)
76 stop
77 ;;
78
79 status)
80 status
81 ;;
82
83 restart)
84 stop
85 start
86 ;;
87
88 condrestart)
89 condrestart
90 ;;
91
92 *)
93 echo "Usage: /etc/init.d/fancontrol
94 {start|stop|status|restart|condrestart}"
95 RETVAL=1
96 esac
97
98 exit $RETVAL