Allow syncing of just inbox rather than all mailboxes

This commit is contained in:
Jonathan Hodgson 2020-09-19 11:09:20 +01:00
parent 237b06631c
commit c80a9ec925
4 changed files with 25 additions and 4 deletions

View file

@ -10,6 +10,11 @@ die(){
exit 1
}
export NOTMUCH_CONFIG="$HOME/.config/notmuch/config"
folder="${1:-all}"
# Ping 1.1.1.1 to confirm that we are on the internet
ping -c 1 "1.1.1.1" > /dev/null 2> /dev/null || die "Need to be connected to the internet"
@ -17,7 +22,12 @@ ping -c 1 "1.1.1.1" > /dev/null 2> /dev/null || die "Need to be connected to the
ps -aux | grep -v grep | grep -q davmail || die "Need to start davmail"
# Sync maildir with exchange
mbsync -c "$HOME/.config/isync/mbsyncrc.secret" work
mbsync -c "$HOME/.config/isync/mbsyncrc.secret" "work-$folder"
# Update notmuch database
notmuch new
new="$(notmuch count "tag:unread")"
[ "$new" -gt "0" ] && notify-send "$new new messages"