#!/bin/sh

###############################################################################
#
# chkconfig: 123 1 80
#
# description: Powerbutton is the driver that is used on the TR440BX mobo. 
#
###############################################################################

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

DMN_NAME=dmnPB
DMN_FULL=/usr/ins/intel/bin/asm/$DMN_NAME

[ -f $DMN_FULL ] || exit 0

RETVAL=0

# See how we were called.
case "$1" in
  start)
        # Start the daemon.
        echo -n "Starting powerbutton: "
        daemon $DMN_FULL
	RETVAL=$?
 	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$DMN_NAME && success "$DMN_FULL startup"
	echo
        ;;
  stop)
        # Stop the daemon.
        echo -n "Stopping powerbutton: "
        killproc $DMN_NAME
	RETVAL=$?
 	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$DMN_NAME
	echo
        ;;
  status)
	# Get the daemon status.
	status $DMN_NAME
	RETVAL=$?
	;;
  restart)
	# Restart the daemon.
	$0 stop
	$0 start
	RETVAL=$?
	;;
  *)
        echo "Usage: $DMN_NAME {start|stop|status|restart}"
        exit 1
esac

exit $RETVAL
