root/lm-sensors/trunk/prog/init/fancontrol.init

Revision 5180, 1.4 KB (checked in by khali, 4 years ago)

pwmconfig: Don't start if fancontrol is running.
fancontrol: Don't start if already running, delete fancontrol.pid at
exit time.
This closes ticket #2299.

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