#!/bin/bash
#
# hpswvclt init script.
#
# description: HP Software Version collector.

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

test -x /usr/hpserver/bin/hpswvclt || 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_HPSWVCLT="yes"
test "$START_HPSWVCLT" = yes || exit 0

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

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

