From ffe6c2b94c700aa9105a6c1b6a0b86853d74cd88 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Thu, 19 May 2011 19:40:47 +0200 Subject: [PATCH] Added ionice when available. --- gma.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gma.sh b/gma.sh index 1e79c72..e266737 100755 --- a/gma.sh +++ b/gma.sh @@ -30,6 +30,12 @@ if [[ -z "${MAIL_ARCHIVE_DIR}" ]]; then exit 1 fi +if [[ $(which ionice) ]]; then + IONICE="ionice -c3" +else + IONICE="" +fi + HEADER_ONLY="-H" while [[ $1 ]]; do @@ -45,6 +51,10 @@ while [[ $1 ]]; do HEADER_ONLY="" ;; + "--intense") + IONICE="" + ;; + "--keepspam") KEEP_SPAM=1 ;; @@ -101,13 +111,13 @@ echo " writing result in ${RESULT_MBOX}" if [[ ${KEEP_SPAM} ]]; then - cat ${FILE_PATTERN} \ + ${IONICE} cat ${FILE_PATTERN} \ | pv -s ${SIZE} -p -t -e - \ | mboxgrep ${HEADER_ONLY} -i "${RE_PREFIX}${PATTERN}" > ${RESULT_MBOX} else - cat ${FILE_PATTERN} \ + ${IONICE} cat ${FILE_PATTERN} \ | pv -s ${SIZE} -p -t -e - \ | mboxgrep ${HEADER_ONLY} -i "${RE_PREFIX}${PATTERN}" \ | mboxgrep ${HEADER_ONLY} -v '^Subject:.*SPAM' > ${RESULT_MBOX} -- 2.39.5