]> git.donarmstrong.com Git - bin.git/commitdiff
use notmuch if it exists
authorDon Armstrong <don@donarmstrong.com>
Thu, 7 Mar 2013 01:32:52 +0000 (17:32 -0800)
committerDon Armstrong <don@donarmstrong.com>
Thu, 7 Mar 2013 01:32:52 +0000 (17:32 -0800)
use ionice if it exists

getmail

diff --git a/getmail b/getmail
index ac82e97e72d678bf3c295614cc088857b219fb65..d8cf11920a02d5bcc69b1a0ae4f33519e7947d9c 100755 (executable)
--- a/getmail
+++ b/getmail
@@ -16,6 +16,11 @@ if [ -z "$HOSTNAME" ]; then
     HOSTNAME="$(hostname)"
 fi;
 
+IONICE=""
+if which ionice >/dev/null 2>&1; then
+    IONICE="ionice -c 3"
+fi;
+
 # if we're not running under cron or there is a mailserver running
 if [ -z "$CRON" ] || kill -0 `pgrep -U $(id -u) -x $MUA` 2>/dev/null; then
     # and we can ping the imap host
@@ -35,7 +40,7 @@ if [ -z "$CRON" ] || kill -0 `pgrep -U $(id -u) -x $MUA` 2>/dev/null; then
            fi;
        fi;
        if [ -z "$PID" ]; then
-           if nice -n 19 offlineimap -o -u Noninteractive.Basic 2>&1 |grep validity| \
+           if nice -n 19 ${IONICE} 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);'; then
@@ -49,6 +54,9 @@ if [ -z "$CRON" ] || kill -0 `pgrep -U $(id -u) -x $MUA` 2>/dev/null; then
                        -rn 1 /home/don/bin/deletemailbox -a $account >/dev/null 2>&1;
                done;
            fi;
+            if which notmuch >/dev/null 2>&1; then
+                nice -n 19 ${IONICE} notmuch new >/dev/null 2>&1;
+            fi;
        fi;
     fi;
 fi;