chiark / gitweb /
bail out if system load is >= 5
authorColin Watson <cjwatson@chiark.greenend.org.uk>
Tue, 3 Apr 2007 16:18:36 +0000 (16:18 +0000)
committerColin Watson <cjwatson@chiark.greenend.org.uk>
Tue, 3 Apr 2007 16:18:36 +0000 (16:18 +0000)
pull-mail

index 828ec37..13f4804 100755 (executable)
--- a/pull-mail
+++ b/pull-mail
@@ -1,5 +1,11 @@
 #! /bin/sh
 
+loadavg="$(cut -d. -f1 /proc/loadavg)"
+if [ "$loadavg" -ge 5 ]; then
+       # System load is too high. Don't contribute to it.
+       exit 0
+fi
+
 date >> ~/.fetchmail/log
 fetchmail >> ~/.fetchmail/log
 bsmtp-pull gluck