chiark / gitweb /
hacky exim queue admin helpers
[bin.git] / pull-mail
1 #! /bin/sh
2
3 if [ -f ~/.nomail ] && [ "$1" != --force ]; then
4         exit 0
5 fi
6
7 loadavg="$(cut -d. -f1 /proc/loadavg)"
8 if [ "$loadavg" -ge 5 ]; then
9         # System load is too high. Don't contribute to it.
10         exit 0
11 fi
12
13 bsmtp-pull gluck
14
15 hour="$(date +%H)"
16 case $hour in
17     0[0-289]|[12]*)
18         date >> ~/.fetchmail/log
19         fetchmail >> ~/.fetchmail/log
20         logrotate -s ~/.fetchmail/logrotate.status ~/.fetchmail/logrotate.conf
21         ;;
22 esac
23
24 exit 0