From ee95c2d562c5bf76058fb8563aebb3a1eade39bd Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Thu, 1 Jun 2017 11:21:58 +0530 Subject: [PATCH] Update mutt mail fetch and notify script for use with systemd --- mutt/mailnotify.sh | 5 +++++ mutt/mailrun.sh | 30 ------------------------------ 2 files changed, 5 insertions(+), 30 deletions(-) delete mode 100755 mutt/mailrun.sh diff --git a/mutt/mailnotify.sh b/mutt/mailnotify.sh index a97b913..4924895 100755 --- a/mutt/mailnotify.sh +++ b/mutt/mailnotify.sh @@ -1,5 +1,10 @@ #!/bin/bash export DISPLAY=:0 + +imapfilter +offlineimap -o -u quiet +notmuch new + let toradex_mail_count=`ls /home/sanchayan/Mail/Toradex/INBOX/new/|wc -l` let stefan_mail_count=`ls /home/sanchayan/Mail/Sanchayan/Stefan/new/|wc -l` let sanchayan_linux=`ls /home/sanchayan/Mail/Sanchayan/Linux\ Kernel/new/|wc -l` diff --git a/mutt/mailrun.sh b/mutt/mailrun.sh deleted file mode 100755 index 1ce2579..0000000 --- a/mutt/mailrun.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash - -# Check every ten seconds if the process identified as $1 is still -# running. After 5 checks (~60 seconds), kill it. Return non-zero to -# indicate something was killed. -monitor() { - local pid=$1 i=0 - - while ps $pid &>/dev/null; do - if (( i++ > 3 )); then - echo "Max checks reached. Sending SIGKILL to ${pid}..." >&2 - kill -9 $pid; return 1 - fi - - sleep 60 - done - - return 0 -} - -read -r pid < ~/.offlineimap/pid - -if ps $pid &>/dev/null; then - echo "Process $pid already running. Exiting..." >&2 - exit 1 -fi - -imapfilter -offlineimap -o -u quiet & monitor $! -#offlineimap -a Toradex -o -u quiet & monitor $!