-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
narcissus: keep sleeping till the load goes down
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
- Loading branch information
Showing
1 changed file
with
11 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
#!/bin/sh | ||
|
||
LOAD="$(cat /proc/loadavg | awk -F. '{print $1}')" | ||
iter=1 | ||
|
||
if [ $LOAD -gt 8 ] ; then | ||
echo "load too high: $LOAD, sleeping" | ||
sleep 20 | ||
sleep $LOAD | ||
echo "$(date) load too high: $LOAD, sleeping" >> /tmp/foo | ||
else | ||
echo "load acceptable: $LOAD, continuing" | ||
while [ $LOAD -gt 12 ] ; do | ||
echo "load too high: $LOAD, sleeping - $iter" | ||
echo "$(date) load too high: $LOAD, sleeping - $iter" >> /tmp/foo | ||
sleep 5 | ||
iter=$(( $iter + 1 )) | ||
LOAD="$(cat /proc/loadavg | awk -F. '{print $1}')" | ||
done | ||
|
||
if [ $iter -gt 1 ] ; then | ||
echo "load acceptable again, continuing after $iter sleep cycles" >> /tmp/foo | ||
fi |