aboutsummaryrefslogtreecommitdiffstats
path: root/Tools/portbuild/scripts/reportload
blob: 56ec0df5196db7224c7d6ffab2dae3b469feb36e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/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}"