chiark / gitweb /
Remove obsolete baz* scripts
[bin.git] / pull-mail
index c0104d4913bb31a13f3205be079e1f0247ae8339..a669a29508d9381b7e505908a1513e0f143e72fd 100755 (executable)
--- a/pull-mail
+++ b/pull-mail
@@ -1,8 +1,26 @@
 #! /bin/sh
 
-date >> ~/.fetchmail/log
-fetchmail >> ~/.fetchmail/log
-bsmtp-pull gluck
-bsmtp-pull klecker
+if [ -f ~/.nomail ] && [ "$1" != --force ]; then
+       exit 0
+fi
+
+loadavg="$(cut -d. -f1 /proc/loadavg)"
+if [ "$loadavg" -ge 5 ] && [ "$1" != --force ]; then
+       # System load is too high. Don't contribute to it.
+       exit 0
+fi
+
+bsmtp-pull master
+
+hour="$(date +%H)"
+case $hour in
+    0[0-4789]|[12]*)
+       date >> ~/.fetchmail/log
+       fetchmail >> ~/.fetchmail/log
+       logrotate -s ~/.fetchmail/logrotate.status ~/.fetchmail/logrotate.conf
+       ;;
+esac
+
+notmuch new >/dev/null 2>&1
 
 exit 0