Making offlineimap not die

I love offlineimap. I even love the quirky way it is hosted on a gopher site. The functionality is awesome. For those of you who don’t know, offlineimap syncronizes a remote IMAP mailbox heirarchy with a local Maildir folder heirarchy. This means you get disconnected IMAP operation with all your favorite Maildir clients (like mutt), while still retaining the ability to access your mail using other IMAP clients.

However, offlineimap crashes too often. Every couple of days I will fail to get any new mail for an hour or two, and realize that offlineimap has crashed. And due to Murphy’s law this generally correlates with a time when I was recieving some important mail.

The solution is very simple. I am using zenity, a command line tool for displaying dialog boxes, and running offline imap in a loop. Every time it dies, I get a pop-up dialog, and can say OK to restart it, or Cancel to end the loop. The little shell script to do this is as follows:

#!/bin/sh

/usr/bin/offlineimap -u TTY.TTYUI;

while zenity –question –text “Offlineimap died. Restart?”; do

/usr/bin/offlineimap -u TTY.TTYUI;

done

Comments are closed.