#!/bin/bash
#
# (C) Copyright 2002-2005 Hewlett-Packard Development Company, L.P.
#
# init file for hp Rack agent
#
# processname: cmarackd

NAME="Rack agent"
PNAME="cmarackd"
PFLAGS="-p 120 -l /var/log/hp-snmp-agents/cma.log"

if [ "x$CMAINCLUDE" = "x" ]; then
   if [ -d /opt/hp/hp-snmp-agents ]; then
        CMAINCLUDE=/opt/hp/hp-snmp-agents/server/etc/cmad
   else
	CMAINCLUDE=/opt/compaq/foundation/etc/cmad
   fi
fi

#we must make sure the cpqriisd daemon is 
#running before starting the cpqrackd

pid=`pidof -o $$ -o $PPID -o %PPID -x $1`
if [ -z "$pid" -a "$1" = "start" ]; then
   if [ -x  /opt/compaq/server/etc/cpqriisd ]; then
      /opt/compaq/server/etc/cpqriisd start
   else
      /opt/hp/hp-snmp-agents/server/etc/cpqriisd start
   fi
elif [ "$1" = "stop" ]; then
   if [ -x  /opt/compaq/server/etc/cpqriisd ]; then
      /opt/compaq/server/etc/cpqriisd stop
   else
      /opt/hp/hp-snmp-agents/server/etc/cpqriisd stop
   fi
elif [ "$1" = "status" ]; then
   if [ -x  /opt/compaq/server/etc/cpqriisd ]; then
      /opt/compaq/server/etc/cpqriisd status
   else
      /opt/hp/hp-snmp-agents/server/etc/cpqriisd status
   fi
fi



. $CMAINCLUDE
