Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | ### BEGIN INIT INFO |
| 3 | # Provides: fancontrol |
| 4 | # Required-Start: $local_fs |
| 5 | # Should-Start: |
| 6 | # Required-Stop: $local_fs |
| 7 | # Should-Stop: |
| 8 | # Default-Start: 2 3 4 5 |
| 9 | # Default-Stop: 0 1 6 |
| 10 | # Short-Description: fancontrol initscript |
| 11 | # Description: Starts and controls the fancontrol daemon |
| 12 | ### END INIT INFO |
| 13 | |
| 14 | PATH=/sbin:/usr/sbin:/bin:/usr/bin |
| 15 | |
| 16 | DESC="fan control daemon" |
| 17 | NAME="fancontrol" |
| 18 | FANCONTROL=`which $NAME` |
| 19 | PIDFILE="/var/run/fancontrol.pid" |
| 20 | |
| 21 | # Exit if the package is not installed |
| 22 | [ -x "$FANCONTROL" ] || exit 0 |
| 23 | |
| 24 | case "$1" in |
| 25 | start) |
| 26 | echo -n "Starting $DESC: $NAME... " |
| 27 | start-stop-daemon -S -p $PIDFILE -b -x $FANCONTROL |
| 28 | echo "done." |
| 29 | ;; |
| 30 | stop) |
| 31 | echo -n "Stopping $DESC: $NAME... " |
| 32 | start-stop-daemon -K -p $PIDFILE |
| 33 | echo "done." |
| 34 | ;; |
| 35 | restart) |
| 36 | echo "Restarting $DESC: $NAME... " |
| 37 | $0 stop |
| 38 | $0 start |
| 39 | echo "done." |
| 40 | ;; |
| 41 | *) |
| 42 | echo "Usage: $0 {start|stop|restart}" |
| 43 | exit 1 |
| 44 | ;; |
| 45 | esac |
| 46 | |
| 47 | exit 0 |