#! /sbin/sh
#Tag 0x00000f00

# System Controller Daemon 
# "$Revision: 1.12 $"

IS_ON=/sbin/chkconfig

case "$1" in
'start')
    #  Start the system controller daemon
    killall -TERM sysctlrd

    # Do we want the powermeter?
    if $IS_ON cpumeter ; then

	# Do we want graceful shutdown?
	if $IS_ON cleanpowerdown ; then
	    /sbin/suattr -C CAP_SCHED_MGT+ip -c "/usr/etc/sysctlrd -d -g" &
	else
	    /sbin/suattr -C CAP_SCHED_MGT+ip -c "/usr/etc/sysctlrd -d" &
	fi
    else

	# Do we want graceful shutdown?
	if $IS_ON cleanpowerdown ; then
	    /sbin/suattr -C CAP_SCHED_MGT+ip -c "/usr/etc/sysctlrd -n -d -g" &
	else
	    /sbin/suattr -C CAP_SCHED_MGT+ip -c "/usr/etc/sysctlrd -n -d" &
	fi
    fi

    ;;  

'stop')
    # Stop the system controller daemon
    killall -TERM sysctlrd
    sleep 2
    /sbin/scmsg "System coming down.."
    exit 0
    ;;

*)
    echo "usage: $0 {start|stop}"
    ;;
esac

