[bin] Expand notmuch-hook.sh into mail-sync.sh

main
Adam Cooper 2 weeks ago
parent c873278609
commit c7a21bd331
  1. 19
      bin/mail-sync.sh
  2. 7
      bin/notmuch-hook.sh

@ -0,0 +1,19 @@
#!/bin/sh
OFFLINEIMAP=$(pgrep offlineimap)
NOTMUCH=$(pgrep notmuch)
if [ -n "$OFFLINEIMAP" ] || [ -n "$NOTMUCH" ]; then
echo "Already running one instance of offlineimap or notmuch. Exiting..."
exit 0
fi
echo "Deleting messages tagged as *deleted*"
notmuch search --format=text0 --output=files tag:deleted | xargs -0 --no-run-if-empty rm -v
offlineimap
notmuch new
# retag all "new" messages "inbox" and "unread"
notmuch tag +inbox +unread -new -- tag:new
# tag all messages from "me" as sent and remove tags inbox and unread
notmuch tag -new -inbox +sent -- from:adam@theadamcooper.com

@ -1,7 +0,0 @@
#!/bin/sh
notmuch new
# retag all "new" messages "inbox" and "unread"
notmuch tag +inbox +unread -new -- tag:new
# tag all messages from "me" as sent and remove tags inbox and unread
notmuch tag -new -inbox +sent -- from:adam@theadamcooper.com
Loading…
Cancel
Save