yselkowitz / rpms / opensm

Forked from rpms/opensm 6 years ago
Clone
Blob Blame History Raw
#!/bin/bash
#
# Launch the necessary OpenSM daemons for systemd
#
# sysconfig: /etc/sysconfig/opensm
# config: /etc/rdma/opensm.conf
#

prog=/usr/sbin/opensm
[ -f /etc/sysconfig/opensm ] && . /etc/sysconfig/opensm

[ -n "$PRIORITY" ] && prio="-p $PRIORITY"

if [ -z "$GUIDS" ]; then
	CONFIGS=""
	CONFIG_CNT=0
	for conf in /etc/rdma/opensm.conf.[0-9]*; do
		CONFIGS="$CONFIGS $conf"
		let CONFIG_CNT++
	done
else
	GUID_CNT=0
	for guid in $GUIDS; do
		let GUID_CNT++
	done
fi
# Start opensm
if [ -n "$GUIDS" ]; then
	SUBNET_COUNT=0
	for guid in $GUIDS; do
		SUBNET_PREFIX=`printf "0xfe800000000000%02d" $SUBNET_COUNT`
		$prog -B $prio -g $guid --subnet_prefix $SUBNET_PREFIX
		let SUBNET_COUNT++
	done
elif [ -n "$CONFIGS" ]; then
	for config in $CONFIGS; do
		$prog -B $prio -F $config
	done
else
	$prog -B $prio
fi
exit 0