#!/bin/sh
#  autospeedstep - starts the  speedstep daemon
#
# chkconfig: 345 66 11
# description:  Speedstep is a daemon for linux kernel \
#		using ACPI which controls the \
#		CPU speed on SpeedStep CPUs \
#		depentend of the CPU load
#		
# processname:  autospeedstep
# Do not load RH compatibility interface.
WITHOUT_RC_COMPAT=1

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

LOCKFILE=/var/lock/subsys/autospeedstep
RETVAL=0

start()
{
	start_daemon --lockfile "$LOCKFILE" --expect-user root -- autospeedstep
	RETVAL=$?
	return $RETVAL
}

stop()
{
	stop_daemon --lockfile "$LOCKFILE" --expect-user root -- autospeedstep
	RETVAL=$?
	return $RETVAL
	rm -f $PIDFILE
}

restart()
{
	stop
	start
}


# See how we were called.
case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	restart)
		restart
		;;
	condstop)
		if [ -e "$LOCKFILE" ]; then
			stop
		fi
		;;
	condrestart)
		if [ -e "$LOCKFILE" ]; then
			restart
		fi
		;;
	status)
		status --expect-user root -- autospeedstep
		RETVAL=$?
		;;
	*)
		msg_usage "${0##*/} {start|stop|restart|condstop|condrestart|status}"		
		RETVAL=1
esac

exit $RETVAL
