freebsd-ports/Tools/portbuild/scripts/reportload
2009-05-21 16:17:15 +00:00

39 lines
854 B
Bash
Executable file

#!/bin/sh
#
# This is run on the clients to report their loads to the server.
# configurable variables
pb=/var/portbuild
arch=$(uname -m)
osver=$(sysctl -n kern.osreldate)
. ${pb}/${arch}/portbuild.conf
if [ -f ${pb}/${arch}/portbuild.$(hostname) ]; then
. ${pb}/${arch}/portbuild.$(hostname)
fi
# Look for exceptional conditions
error=
for i in squid disk; do
if [ -f ${scratchdir}/.${i} ]; then
error="${i} ${error}"
fi
done
num=$(echo $(ls -1d ${scratchdir}/*/*/*/used ${scratchdir}/*/*/chroot/*/used 2>/dev/null| wc -l))
echo "arch=${arch}"
echo "osversion=${osver}"
echo "jobs=${num}"
cd /var/portbuild/${arch}
for i in */builds/*; do
buildenv=${arch}/${i%%/*}/${i##*/}
if [ -f ${i}/.ready ]; then
buildenvs="${buildenv} ${buildenvs}"
fi
done
echo "buildenvs=${buildenvs}"
echo -n "load="
uptime
echo "error=${error}"