mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-06 06:30:19 +00:00
36 lines
1.2 KiB
Bash
Executable File
36 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Runs in the background on the server. This script keeps track of
|
|
# the relative loads of the client machines, and specifies which machine(s)
|
|
# should be handed new jobs, according to the following algorithm:
|
|
#
|
|
# For each machine listed in ${buildroot}/mlist, check whether its load
|
|
# information has been updated in the last 15 seconds (should be updated by
|
|
# the reportload script every 5 seconds). If so, then divide the number of
|
|
# running jobs on the client by its weighting in mlist, and output the
|
|
# machine(s) with the minimum value to ${buildroot}/ulist.
|
|
#
|
|
# Dividing by the weight has the effect of grouping machines with similar
|
|
# job load (e.g. a weight of 5 will rank machines with job loads 0, 1, 2, 3, 4
|
|
# as the same; if the machines all had a weight of 1 then it would only
|
|
# choose the machine with the least value of the job load, and would probably
|
|
# choose a single machine most of the time).
|
|
|
|
buildroot=/var/portbuild
|
|
|
|
arches=$*
|
|
|
|
while true; do
|
|
for i in ${arches}; do
|
|
mlist=${buildroot}/${i}/mlist
|
|
|
|
set $(cat $mlist)
|
|
while [ $# -gt 0 ]; do
|
|
m=$1
|
|
${buildroot}/scripts/pollmachine ${i} ${m}
|
|
shift 1
|
|
done
|
|
done
|
|
sleep 120
|
|
done
|