#!/bin/sh

# chkconfig: 2345 88 06
# description: This script enables Athlon CPU cooling feature. see /usr/share/doc/fvcool-*/ReadMe
#

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

RETVAL=0
SERVICENAME="AMD Athlon/Duron cooling"
FVCOOL=/usr/sbin/fvcool

TryFVcool ()
{
	if $FVCOOL $1
	then
		RETVAL=$?
		success $1
	else
		RETVAL=$?
		failure $1
	fi
	return $RETVAL
}


# See how we were called.
case "$1" in
  condrestart)
  	;;
  start)
	echo "Enabling $SERVICENAME: "
	TryFVcool -e
	RETVAL=$?
	;;
  stop|condstop)
	echo "Disabling $SERVICENAME: "
	TryFVcool -d
	RETVAL=$?
	;;
  status)
	$FVCOOL -v
	RETVAL=$?
	;;
  restart)
  	"$0" stop; "$0" start
  	;;
  *)
	echo "Usage: $0 {start|stop|status|restart}"
	exit 1
esac

exit $RETVAL

