chiark / gitweb /
untested git support
[bin.git] / pull-mail
old mode 100644 (file)
new mode 100755 (executable)
index 2c11b99..13f4804
--- a/pull-mail
+++ b/pull-mail
@@ -1,10 +1,13 @@
 #! /bin/sh
-set -e
 
-if ! [ -e ~/.nomail ]; then
-    date >> ~/.fetchmail/log
-    fetchmail >> ~/.fetchmail/log
-    bsmtp-pull gluck
+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
+
 exit 0