#!/bin/sh
#
# ddclient      This shell script takes care of starting and stopping fanctrld.
#
# chkconfig:    345 65 35
# description:  fanctrld controls the fan on an IBM thinkpad
# processname:  ddclient
# config:       /etc/sysconfig/fanctrld

# Source networking configuration.
. /etc/default/fanctrld

exec=/usr/local/sbin/fanctrld
prog=$(basename $exec)
pidfile=/var/run/$prog.pid

start() {
    /sbin/modprobe ibm_acpi
    echo -n $"Starting $prog: "
    #daemon $exec $FANCTRLD_OPTIONS
    start-stop-daemon --start --exec $exec  -- $FANCTRLD_OPTIONS
    echo .
}

stop() {
    echo -n $"Stopping $prog: "
    start-stop-daemon --stop --exec $exec  -- $FANCTRLD_OPTIONS
    echo .
}

restart() {
    stop
    start
}

reload() {
    restart
}

force_reload() {
    restart
}

# See how we were called.
case "$1" in
    start|stop|restart|reload)
        $1
        ;;
    force-reload)
        force_reload
        ;;
    *)
        echo $"Usage: $0 {start|stop|restart|reload|force-reload}"
        exit 2
esac
