#!/bin/bash
lxc-ls --active -1 | grep Assistant || {
echo "`date` This script can be called only from the Primary Node (= Node on which Assistant is running)"
exit -1
}

aline=$(2>/dev/null /opt/inventory/inventory appliance_list --full  | xpath -e '//appliance[(hasSBC="true")]/id' 2>/dev/null | sed -e "s/<\//§\n/g" | sed -e "s/.*>//g")
		arrIds="§"
		index=0
		applcount=0
		while [ 1 ]; do
			anelem=`echo -en ${aline%%§*}`
			anelem=${anelem%+*}
			[ "x" = "x$anelem" ] && break
			aline=${aline#*§}
			applcount=$(($applcount+1))
		done
exit $applcount
