aboutsummaryrefslogtreecommitdiff
path: root/Tools/portbuild/scripts/pollmachine
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/portbuild/scripts/pollmachine')
-rwxr-xr-xTools/portbuild/scripts/pollmachine33
1 files changed, 33 insertions, 0 deletions
diff --git a/Tools/portbuild/scripts/pollmachine b/Tools/portbuild/scripts/pollmachine
new file mode 100755
index 000000000000..75cd9885ddee
--- /dev/null
+++ b/Tools/portbuild/scripts/pollmachine
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+buildroot=/var/portbuild
+
+i=$1
+m=$2
+if [ "$3" = "-queue" ]; then
+ queue=1
+else
+ queue=0
+fi
+
+infoseek_host=$m
+infoseek_port=infoseek
+. ${buildroot}/${i}/portbuild.conf
+if [ -f ${buildroot}/${i}/portbuild.${m} ]; then
+ . ${buildroot}/${i}/portbuild.${m}
+fi
+if (/usr/local/bin/nc -w 5 ${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