Re: Connection problems
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Additionally, with less log overhead the following works:
while true; do offlineimap; done
:)
On Mon, 19 Apr 2004, Matthew P. Barnson wrote:
> 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.
>
> ===============================
>
> #!/bin/bash
> # A shell script to restart offlineimap if it dies.
>
> OFFLINEIMAP=/usr/bin/offlineimap
> LOGFILE=~/offlineimap.log
> PIDFILE=~/offlineimap.pid
>
> while [ 1 == 1 ]; do
> if [ "`ps ax | grep -f $PIDFILE`" != "" ]; then
> echo "offlineimap is still up @ `date`"
> else
> echo "offlineimap down @ `date`, starting it up."
> $OFFLINEIMAP >> $LOGFILE 2>&1 &
> echo "$!" > $PIDFILE
> fi
> sleep 60
> done
>
>
> --
> 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.
micah
----
"Naturally, the common people don't want war, but after all, it
is the leaders of a country who determine the policy...Voice or no
voice, the people can always be brought to the bidding of the leaders.
This is easy. All you have to do is to tell them they are being
attacked, and denounce the pacifists for lack of patriotism and
exposing the country to danger. It works the same in every country."
-- Goering, Nuremburg trial
|
|