File: fancontrol.init

package info (click to toggle)
lm-sensors 1%3A3.6.0-7
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 3,236 kB
  • sloc: perl: 6,461; ansic: 5,303; sh: 2,301; lex: 372; yacc: 296; makefile: 220
file content (98 lines) | stat: -rwxr-xr-x 1,462 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/sh
#
# fancontrol
#
# chkconfig: 2345 90 01
# description: start/stop fancontrol
# pidfile: /var/run/fancontrol.pid
#

PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
export PATH

# Source function library.
. /etc/rc.d/init.d/functions

FANCONTROL="/usr/local/sbin/fancontrol"
PIDFILE="/var/run/fancontrol.pid"

RETVAL=0

start()
{
   echo -n "Starting fancontrol daemon"
   daemon $FANCONTROL -d
   RETVAL=$?
   [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fancontrol
   echo
}

stop()
{
   echo -n "Stopping fancontrol daemon"
   killproc $FANCONTROL
   RETVAL=$?
   rm -f /var/lock/subsys/fancontrol
   echo
}

status()
{
   if [ -f $PIDFILE ] ; then
     pid=`cat $PIDFILE`
   else
     echo -n "$FANCONTROL does not appear to be running"
     echo
     exit
   fi

   if [ -n "$pid" ] ; then
     ps -p $pid > /dev/null
     if [ $? ] ; then
       echo -n "$FANCONTROL appears to be running"
     else
       echo -n "$FANCONTROL does not appear to be running"
     fi
     echo
   fi
}

condrestart()
{
   [ -e /var/lock/subsys/fancontrol ] && restart || :
}

if [ ! -x $FANCONTROL ] ; then
   echo "Cannot run $FANCONTROL"
   exit 0
fi

case "$1" in
   start)
     start
     ;;

   stop)
     stop
     ;;

   status)
     status
     ;;

   restart)
     stop
     start
     ;;

   condrestart)
     condrestart
     ;;

   *)
     echo "Usage: /etc/init.d/fancontrol 
{start|stop|status|restart|condrestart}"
     RETVAL=1
esac

exit $RETVAL