#!/bin/sh # Configure the two things below for your MUA and the host being run. IMAPHOST=rzlab.ucr.edu MUA=mutt #set -x # Don't check mail if ~/.nocheck exists and we're not running # interactively. if [[ -z "$CRON" && -e ~/.nocheck ]]; then exit 0; fi; # See if the server exists if [ -z "$CRON" ] || kill -0 `pgrep -U $(id -u) -x $MUA` 2>/dev/null; then if ping -q -c 3 $IMAPHOST >/dev/null 2>&1; then nice -n 19 offlineimap -o -u Noninteractive.Basic 2>&1 |grep validity| \ perl -ne 'my ($account,$list) = /UID validity problem for folder ([\w-]+)\.([\w-]+)/; next unless defined $account and length $account; qx(/home/don/bin/deletemailbox -a $account $list > /dev/null);'; fi; fi;