chiark / gitweb /
ubuntu-paste: convert to python3/argparse/requests
[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 ] && [ "$1" != --force ]; then
9         # System load is too high. Don't contribute to it.
10         exit 0
11 fi
12
13 bsmtp-pull master
14
15 hour="$(date +%H)"
16 case $hour in
17     0[0-4789]|[12]*)
18         date >> ~/.fetchmail/log
19         fetchmail >> ~/.fetchmail/log
20         logrotate -s ~/.fetchmail/logrotate.status ~/.fetchmail/logrotate.conf
21         ;;
22 esac
23
24 notmuch new >/dev/null 2>&1
25
26 exit 0