#!/bin/bash

# Copyright 2002 hp Information Technologies Group, L.P.
#
# See "man chkconfig" for information on next two lines (Red Hat only)
# chkconfig: - 2345 91 1
# description: HP Advanced System Management Drivers and Agents for Linux
#
#
# Following lines are in conformance with LSB 1.2 spec
### BEGIN INIT INFO
# Provides:            hpasm
# Required-Start:      snmp
# Required-Stop:       hprsm cmanic cmastor
# Default-Start:       2 3 4 5
# Default-Stop:        0 1 6
# Description:         starts hpasm (HP Advanced System Management Drivers and Agents)
### END INIT INFO
if [ -f /etc/rc.status ]; then
. /etc/rc.status
fi

if [ -f /etc/rc.config ]; then
. /etc/rc.config
fi

RETVAL=0
SCRIPT=/opt/compaq/hpasm/etc/hpasm

ACTION=$1
shift
ADDARGS=$*

rc_reset

# See how we were called.
case "$ACTION" in
  start)
	$SCRIPT start $ADDARGS
	;;
  stop)
	$SCRIPT stop $ADDARGS
	;;
  restart)
	$SCRIPT stop $ADDARGS
	$SCRIPT start $ADDARGS
	;;
  status)
	$SCRIPT status $ADDARGS
	;;
  configure)
	$SCRIPT configure $ADDARGS 
	rc_status
	rc_status -v
	;;
  reconfigure)
	$SCRIPT reconfigure $ADDARGS 
	rc_status
	rc_status -v
	;;
  unconfigure)
	$SCRIPT unconfigure $ADDARGS 
	rc_status
	rc_status -v
	;;
  *)
	# do not advertise unreasonable commands that there is no reason
	# to use with this device
	echo "Usage: hpasm {start|stop|status|restart|configure|unconfigure|reconfigure}"
	exit 1
esac

exit 0
