Complete.Org: Mailing Lists: Archives: offlineimap: April 2004:
Re: Connection problems

Re: Connection problems

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Micah Anderson <micah@xxxxxxxxxx>
Cc: offlineimap@xxxxxxxxxxxx
Subject: Re: Connection problems
From: "Matthew P. Barnson" <matthew@xxxxxxxxxxx>
Date: Mon, 19 Apr 2004 11:32:04 -0600

On Mon, Apr 19, 2004 at 11:30:33AM -0500, Micah Anderson wrote:
> I often startup offlineimap when I startup, and just
> let it autorefresh during the day. This works great, except when my
> network connection dies, either because the wireless connection is
> bad, or because the DSL goes down, or for whatever reason.

This is a common problem with my wireless link as well.  Though I'm certain
it would be trivial to tell it to monitor itself in Python, I wrote a
little Bash wrapper around it.  I run Mutt on Win32 using Maildir on a
Cygwin managed-mount, so your mileage may vary as far as if the script
works out of the box.  Should work fine on any Linux box, but if you're
using Solaris or other operating systems with different options for "ps" or
"grep", it may fail.  Just change the options to match your system.

Just copy the text below to a directory in your $PATH as any name you like,
chmod 755 the file, and then run it.


# A shell script to restart offlineimap if it dies.


while [ 1 == 1 ]; do
    if [ "`ps ax | grep -f $PIDFILE`" != "" ]; then
         echo "offlineimap is still up @ `date`"
        echo "offlineimap down @ `date`, starting it up."
        $OFFLINEIMAP >> $LOGFILE 2>&1 &
        echo "$!" > $PIDFILE
    sleep 60

Matthew P. Barnson
- - - -
Thought for the moment:
Advice to young men: Be ascetic, and if you can't be ascetic,
then at least be aseptic.

[Prev in Thread] Current Thread [Next in Thread]