########################################################################
# #
# This software is part of the ast package #
# Copyright (c) 1990-2011 AT&T Intellectual Property #
# and is licensed under the #
# Eclipse Public License, Version 1.0 #
# by AT&T Intellectual Property #
# #
# A copy of the License is available at #
# (with md5 checksum b35adb5213ca9657e911e9befb180842) #
# #
# Information and Software Systems Research #
# AT&T Research #
# Florham Park NJ #
# #
# Glenn Fowler <gsf@research.att.com> #
# #
########################################################################
#
# genlocal [options] [host ...]
#
# @(#)genlocal (AT&T Research) 2002-10-02
#
#
esac
integer cluster=5
dir=.
file=
heading=1
list=
timeout=90
verbose=:
while :
do case $# in
0) break ;;
esac
case $1 in
1) set -- '-?'
break
;;
esac
case $1 in
-f) file=$2 ;;
-r) rsh=$2 ;;
-t) timeout=$2 ;;
esac
shift
;;
-h) heading=
;;
-n) list=1
;;
-v) verbose='print -u2'
;;
'-?') break
;;
[-+]*) print -u2 "$0: $1: invalid option"
set -- '-?'
break
;;
*) break
;;
esac
shift
done
case $1 in
esac
'}
IFS=:
while :
do shift
case $1 in
"") continue ;;
--) break ;;
esac
esac
done
shift
esac
;;
*) if test ! -f $file
fi
;;
esac
print -u2 "$0: warning: $rsh may hang on some hosts -- monitor the progress with the -v option or ps $$"
esac
done
case $# in
{
)
set -- $(
{
print "$hostname"
{
for i in /etc/resolv.conf /usr/etc/resolv.conf
do if test -f $i
break
fi
done
} |
awk '{print $2}'
sort -u
)
;;
esac
;;
esac
esac
for host
esac
*" $host "*) continue ;;
esac
;;
info=$!
{
kill -9 $info
} &
time=$!
wait $info
kill -9 $time
fi
;;
eval "case '$host' in
$server) idle= ;;
*) idle=15m ;;
esac"
integer v c d i j k n
((n=0))
do ((n=n+1))
h[n]=$host
t[n]=$type
v[n]=$rate
a[n]=$attr
done
c=1
while ((c))
do ((c=0))
((i=1))
while ((i<n))
do ((d=v[i+1]-v[i]))
then ((d=d/2))
((v[i]=v[i]+d))
((v[i+1]=v[i+1]-d))
c=1
fi
((i=i+1))
done
done
((i=1))
while ((i<=n))
do ((c=v[i]))
((j=i+1))
((k=1))
while ((j<=n))
then break
fi
((c=c+v[j]))
((k=k+1))
((j=j+1))
done
((c=c/k))
((d=c%10))
((c=c-d))
if ((d>6))
then ((c=c+10))
elif ((d>3))
then ((c=c+5))
fi
while ((i<j))
do ((v[i]=c))
((i=i+1))
done
done
((i=1))
while ((i<=n))
do rate=${v[i]}
print ${h[i]} ${t[i]} rating=${v[i]}" ${a[i]}"
((i=i+1))
done
1) print '#'
print '# local host attributes'
print '#'
print
print 'local busy=2m pool=9'
print
;;
''|$type)
;;
*) print
;;
esac
????????*)
tab1=" "
;;
*) tab1=" "
;;
esac
????????*)
tab2=" "
;;
*) tab2=" "
;;
esac
done