Created
November 2, 2020 13:56
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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