# BEGIN_ICS_COPYRIGHT8 ****************************************
# END_ICS_COPYRIGHT8   ****************************************

# [ICS VERSION STRING: @(#) ./bin/iba_startup 7_4_3_0_2 [01/26/18 09:02]

# start the given component

comp=$1
if [ x"$comp" = x ]
then
	echo "Usage: $0 component" >&2
	exit 2
fi

if [ -d /etc/init.d ]
then
	INIT_DIR=/etc/init.d
elif [ -d /etc/rc.d/init.d ]
then
	INIT_DIR=/etc/rc.d/init.d
elif [ -d /Library/SilverStorm/Infiniband/init.d ]
then
	INIT_DIR=/Library/SilverStorm/Infiniband/init.d/
else
	echo "$0: Infiniband start scripts not installed" >&2
	exit 1
fi

if [ ! -f $INIT_DIR/$comp ]
then
	echo "$0: $comp not installed" >&2
	exit 2
fi

case $0 in
	*iba_start)
		$INIT_DIR/$comp start
		exit $?;;
	*iba_stop)
		$INIT_DIR/$comp stop
		exit $?;;
	*iba_restart)
		$INIT_DIR/$comp restart
		exit $?;;
	*)
		echo "$0: Invalid command name" >&2
		exit 1;;
esac
