Skip to content

Instantly share code, notes, and snippets.

@m4lvin
Created November 2, 2020 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m4lvin/43c01b61f9f106b5f6bb29fb53e78be2 to your computer and use it in GitHub Desktop.
Save m4lvin/43c01b61f9f106b5f6bb29fb53e78be2 to your computer and use it in GitHub Desktop.
using inotifywait via SSH to watch a remote Maildir for mu4e and syncmaildir - replacing IMAP IDLE
#!/bin/bash
while true
do
echo "monitoring the remote Maildir ..."
if (ssh myemailserver inotifywait "~/Maildir" -e close_write); then
echo "got notification!"
date --rfc-3339=seconds
else
echo "connection lost!?"
exit 1
fi
echo "getting new email ..."
smd-pull --verbose && smd-push --verbose
if pgrep -f 'mu server'; then
echo "mu server is already running, telling emacs to update ..."
emacsclient -e '(mu4e-update-index)'
else
echo "running mu index ..."
mu index
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment