Skip to content

Commit

Permalink
Narcissus: throttle package install when the load is too high
Browse files Browse the repository at this point in the history
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
  • Loading branch information
koenkooi committed Jan 7, 2011
1 parent 74a658e commit a244403
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripts/install-package.sh
Expand Up @@ -32,6 +32,9 @@ echo $packagelist > ${TARGET_DIR}.txt

echo "installing $packagelist"
for pkg in $packagelist ; do
# Sleep N seconds when the load on the buildserver is too high
sh ${PWD}scripts/sleep.sh

echo "running: opkg-cl ${CACHE} -o ${TARGET_DIR} -f ${TARGET_DIR}/etc/opkg.conf -t ${OPKG_TMP_DIR} install $pkg"
yes | bin/opkg-cl ${CACHE} -o ${TARGET_DIR} -f ${TARGET_DIR}/etc/opkg.conf -t ${OPKG_TMP_DIR} install $pkg | tee ${TARGET_DIR}/log.txt
grep -e "rror oc" -e "ollected er" ${TARGET_DIR}/log.txt
Expand Down
10 changes: 10 additions & 0 deletions scripts/sleep.sh
@@ -0,0 +1,10 @@
#!/bin/sh

LOAD="$(cat /proc/loadavg | awk -F. '{print $1}')"

if [ $LOAD -gt 10 ] ; then
echo "load to high: $LOAD, sleeping"
sleep 10
else
echo "load acceptable: $LOAD, continuing"
fi

0 comments on commit a244403

Please sign in to comment.