Alan,
Here's what I did: it will read the token of the incoming DTU and
based on information you set up, will direct that DTU to a certain WTS
or set of WTSs.
/opt/SUNWutWBT/SUNWutWBT [load balancing part from Craig Bender; I
changed the "ps -ef" to "/usr/ucb/ps -axww" to get the full line in the
process table]
# Look up the DTU's MAC and find the corresponding WTS category
# to which it belongs.
target_WTS_category=`cat $prog_dir/token_to_WTS_category_mapping | grep
-i $SUN_SUNRAY_TOKEN | awk '{print $2}'`
case $target_WTS_category in
open_office ) WTSARRAY="rspc30-sunts07";;
* ) WTSARRAY="rspc30-sunts05
rspc30-sunts08";;
esac
...
# Server Check and Calculation Area - Do not edit below this line
#
set -x
for i in `echo $WTSARRAY`
do
/usr/sbin/ping $i 2
if [ $? -eq 0 ]
then
echo $i is pingable
if [ $LBWTSARRAY ]
then
LBWTSARRAY=$LBWTSARRAY:$i
export LBWTSARRAY
else
LBWTSARRAY=$i
export LBWTSARRAY
fi
else echo $i is not reachable
echo $i will not be used for load balancing
fi
done
echo Will check `echo $LBWTSARRAY|awk -F: '{ for (i = NF; i > 0; --i)
print $i
}'` to see which has the fewest connections.
LOWEST=999
export LOWEST
for i in `echo $LBWTSARRAY|awk -F: '{ for (i = NF; i > 0; --i) print $i
}'`
do
COUNT=`/usr/ucb/ps -axww | grep $i | grep -v grep | wc -l`
if [ $COUNT -lt $LOWEST ] && [ $COUNT -ge 0 ]
then
echo $i has $COUNT connections
LOWEST=$COUNT
WTS=$i
echo WTS $i
else
echo $i has the same or more connections than other servers
fi
done
echo Will connect to $WTS that has $LOWEST connections
/opt/SUNWutWBT/token_to_WTS_category_mapping
pseudo.00144f579d7d open_office
pseudo.00144f579c2e open_office
_______________________________________________
SunRay-Users mailing list
[email protected]
http://www.filibeto.org/mailman/listinfo/sunray-users