#!/bin/sh # $FreeBSD: ports/Tools/portbuild/scripts/reportload,v 1.16 2010/12/01 02:23:14 linimon Exp $ # client script to report load to the server. pbd=${PORTBUILD_DATA:-/a/portbuild} # note: uname is not being overridden arch=$(uname -m) osver=$(sysctl -n kern.osreldate) # set up configuration, or immediately error out if impossible error= if [ ! -d ${pbd}/${arch} ]; then error="disk" else if [ ! -f ${pbd}/${arch}/client.conf ]; then error="disk" else . ${pbd}/${arch}/client.conf fi if [ ! -f ${pbd}/${arch}/portbuild.conf ]; then error="disk" else . ${pbd}/${arch}/portbuild.conf fi if [ -f ${pbd}/${arch}/portbuild.$(hostname) ]; then . ${pbd}/${arch}/portbuild.$(hostname) fi # iterate buildenvs cd ${pbd}/${arch} for i in */builds/*; do buildenv=${arch}/${i%%/*}/${i##*/} if [ -f ${i}/.ready ]; then buildenvs="${buildenv} ${buildenvs}" fi done fi # Look for exceptional conditions for i in squid disk; do if [ -f ${scratchdir}/.${i} ]; then error="${i} ${error}" fi done # XXX MCL DEBUG 20100727 # on occasion, a machine winds up with a huge number (> 300) of chroots. # When this happens, the following command takes more than a minute, and # pointyhat will pound it to death, resulting in 'kern.ipc.maxpipekva # exceeded; see tuning(7)'. So, as a workaround until the reason for the # stale chroots is understood, limit the time we allow this to run. ulimit -t 10 num=$(echo $(ls -1d ${scratchdir}/*/*/*/used ${scratchdir}/*/*/chroot/*/used 2>/dev/null| wc -l)) echo "arch=${arch}" echo "osversion=${osver}" echo "jobs=${num}" echo "buildenvs=${buildenvs}" echo "load="`uptime` echo "error=${error}"