Files
ports/Tools/portbuild/scripts/pollmachine
T
Kris Kennaway 064bda8040 * Switch from netcat port to base system nc. Replace symbolic port name
by its numeric equivalent since nc(1) does not look up the former.
2007-07-29 19:45:43 +00:00

36 lines
754 B
Bash
Executable File

#!/bin/sh
buildroot=/var/portbuild
i=$1
m=$2
if [ "$3" = "-queue" ]; then
queue=1
else
queue=0
fi
infoseek_port=414
. ${buildroot}/${i}/portbuild.conf
if [ -f ${buildroot}/${i}/portbuild.${m} ]; then
. ${buildroot}/${i}/portbuild.${m}
fi
if [ -z "${infoseek_host}" ]; then
infoseek_host=$m
fi
if (/usr/bin/nc -w 15 ${infoseek_host} ${infoseek_port} > ${buildroot}/${i}/loads/$m < /dev/null); then
if [ "${queue}" = 1 ]; then
num=$(awk '{print $1}' ${buildroot}/${i}/loads/$m)
if [ "$num" -lt "${maxjobs}" ]; then
echo ${num} > ${buildroot}/${i}/queue/$m
chown ports-${i} ${buildroot}/${i}/queue/$m
else
rm -f ${buildroot}/${i}/queue/$m
fi
fi
else
rm -f ${buildroot}/${i}/queue/$m
exit 1
fi
exit 0