Update mutt mail fetch and notify script for use with systemd

This commit is contained in:
Sanchayan Maity 2017-06-01 11:21:58 +05:30
parent 49f51b8941
commit ee95c2d562
2 changed files with 5 additions and 30 deletions

View file

@ -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`

View file

@ -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 $!