Skip to content

Commit

Permalink
- fix disk usage monitoring
Browse files Browse the repository at this point in the history
- try to stop background build script monitor in a clean way
  • Loading branch information
adrianschroeter committed Jan 8, 2013
1 parent f2e087a commit bb6cd9e
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ vm_img_mkfs()

background_monitor_process()
{
max=0
max_disk=0
max_mem=0
while sleep 5; do

Expand All @@ -630,14 +630,16 @@ background_monitor_process()
fi

# disk storage usage
if [ -x /usr/bin/df ]; then
c=(`/usr/bin/df -m $1 | tail -n 1`)
if type -p df >& /dev/null; then
c=(`df -m / | tail -n 1`)

if [ ${c[2]} -gt $max ]; then
max="${c[2]}"
echo -n $max > /.build/_statistics.df
if [ ${c[2]} -gt $max_disk ]; then
max_disk="${c[2]}"
echo -n $max_disk > /.build/_statistics.df
fi
fi

[ -e /.build/_statistics.exit ] && exit 0
done
}

Expand Down Expand Up @@ -697,7 +699,7 @@ detect_vm_2nd_stage()
HOST="$MYHOSTNAME"

# fork a process monitoring max filesystem fillment during build
background_monitor_process / >& /dev/null &
background_monitor_process &

return 0
}
Expand Down Expand Up @@ -2291,6 +2293,10 @@ for SPECFILE in "${SPECFILES[@]}" ; do
test -d "$SRCDIR" && cd "$SRCDIR"
done

if test -n "$RUNNING_IN_VM" -a -n "$VM_SWAP"; then
touch /.build/_statistics.exit
fi

RPMS=`find $BUILD_ROOT/$TOPDIR/RPMS -type f -name "*.rpm" 2>/dev/null || true`
DEBS=`find $BUILD_ROOT/$TOPDIR/DEBS -type f -name "*.deb" 2>/dev/null || true`

Expand Down

0 comments on commit bb6cd9e

Please sign in to comment.