#!/bin/bash
#
# Init file for Athlon powersaving mode.
#
# chkconfig: 2345 10 90
# description: Athlon powersaving mode
#
# processname: athcool
# pidfile: /var/run/athcool.pid

WITHOUT_RC_COMPAT=1

. /etc/init.d/functions

PIDFILE=/var/run/athcool.pid
LOCKFILE=/var/lock/subsys/athcool
EXTRAOPTIONS=" &>/dev/null"

RETVAL=0

start() {
        msg_starting    $"Starting up athlon powersaving: "
        start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" -- athcool on $EXTRAOPTIONS
        RETVAL=$?
        return $RETVAL
}

stop() {
        msg_stopping $"Shutting down athlon powersaving: "
        start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" -- athcool off $EXTRAOPTIONS
        RETVAL=$?
        return $RETVAL
}

restart() {
        stop
        start
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  status)
        status --pidfile "$PIDFILE" athcool stat
        RETVAL=$?
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|status}"
        RETVAL=1
esac

exit $RETVAL
