#!/bin/sh
##
# powerman.init,v 1.3 2001/12/12 20:08:46 dun Exp
##
# chkconfig: - 95 5
# description:	PowerMan manages Remote Power Controller (RPC) devices
# processname:	/usr/sbin/powermand
# config:	/etc/powerman/powerman.conf
##

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

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

DAEMON=powermand
RETVAL=0

[ -x "/usr/sbin/$DAEMON" ] || exit 0

# See how we were called.
case "$1" in
  start)
	echo -n "Starting PowerMan: "
	daemon $DAEMON
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$DAEMON
	;;
  stop)
	echo -n "Shutting down PowerMan: "
	killproc $DAEMON
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$DAEMON
	;;
  status)
	status $DAEMON
	RETVAL=$?
	;;
  restart)
	$0 stop
	$0 start
	RETVAL=$?
	;;
  reload)
	echo -n "Reloading PowerMan: "
	killproc $DAEMON -HUP
	RETVAL=$?
	echo
	;;
  *)
	echo "Usage: $DAEMON {start|stop|status|restart|reload}"
	exit 1
esac

exit $RETVAL
