From: Colin Watson Date: Sat, 9 May 2009 07:23:39 +0000 (+0000) Subject: support .nomail/--force; don't run fetchmail on hours 3-7 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?p=bin.git;a=commitdiff_plain;h=8c814ab2a421dc5377b2ddcde4099ec1b1b12d41 support .nomail/--force; don't run fetchmail on hours 3-7 --- diff --git a/pull-mail b/pull-mail index 13f4804..9653250 100755 --- a/pull-mail +++ b/pull-mail @@ -1,13 +1,24 @@ #! /bin/sh +if [ -f ~/.nomail ] && [ "$1" != --force ]; then + exit 0 +fi + 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 +hour="$(date +%H)" +case $hour in + 0[0-289]|[12]*) + date >> ~/.fetchmail/log + fetchmail >> ~/.fetchmail/log + logrotate -s ~/.fetchmail/logrotate.status ~/.fetchmail/logrotate.conf + ;; +esac + exit 0