#!/bin/bash
#
# hppciclt init script.
#
# description: HP PCI Information collector.

# Source function library.
. /etc/rc.config

test -x /usr/hpserver/bin/hppciclt || exit 1

# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}

# Force execution if not called by a runlevel directory.
test $link = $base && START_HPPCI="yes"
test "$START_HPPCI" = yes || exit 0

#
#	See how we were called.
#

return=$rc_done
case "$1" in
  start)
	# Check if hppciclt is already running
	if [ ! -f /var/lock/subsys/hppciclt ]; then
	    echo -n 'Starting HP PCI Information collector: '
	    /usr/hpserver/bin/hppciclt || return=$rc_failed
	    [ "$return" = "$rc_done" ] && touch /var/lock/subsys/hppciclt
	    echo -e "$return"
	fi
	;;
  stop)
	rm -f /var/lock/subsys/hppciclt
	;;
  *)
	echo "Usage: /etc/rc.d/init.d/hppciclt {start|stop}"
	exit 1
esac

test "$return" = "$rc_done" || exit 1
exit 0

