From 7ab076e9a34703804e9559bacb050342f3b65f6f Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Tue, 2 Feb 2010 15:23:02 +1300 Subject: [PATCH] factor out offlineimap to script and call notmuch Signed-off-by: martin f. krafft --- .bin/offlineimap | 17 +++++++++++++++++ .crontab.d/offlineimap | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100755 .bin/offlineimap diff --git a/.bin/offlineimap b/.bin/offlineimap new file mode 100755 index 0000000..ad01298 --- /dev/null +++ b/.bin/offlineimap @@ -0,0 +1,17 @@ +#!/bin/sh +set -eu + +if ! test -t 0; then + echo Renicing because we are not run interactively… >&2 + renice 20 -p $$ >/dev/null + ionice -c2 -n7 -p $$ +fi + +ret=0 +/usr/bin/offlineimap -o "$@" || ret=$? + +if [ -x "$(command -v notmuch)" ]; then + notmuch new +fi + +exit $ret diff --git a/.crontab.d/offlineimap b/.crontab.d/offlineimap index cfbea97..907edc9 100644 --- a/.crontab.d/offlineimap +++ b/.crontab.d/offlineimap @@ -1,2 +1,2 @@ -*/15 * * * * sleep $((900 * $RANDOM / 32768)) && ip r | grep -q via && ionice -c3 nice -20 offlineimap -o -38 */4 * * * sleep $((60 * $RANDOM / 32768)) && ip r | grep -q via && ionice -c3 nice -20 offlineimap -oa logcheck +*/15 * * * * sleep $((900 * $RANDOM / 32768)) && ip r | grep -q via && $HOME/.bin/offlineimap +38 */4 * * * sleep $((60 * $RANDOM / 32768)) && ip r | grep -q via && $HOME/.bin/offlineimap -a logcheck -- 2.39.2