<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body style="font-family: Times New Roman; font-size: 16px;"
    bgcolor="#ffffff" text="#000000">
    <div style="font-family: Times New Roman; font-size: 16px;"><font
        face="Times New Roman">Hi, <br>
        <br>
        I use a couple of scripts called by Cron, one of which checks
        for a running offlineimap process; if it's not there, it
        restarts (once a minute). <br>
        I've occasionally see offlineimap "lock up" totally; in the
        interests of working around this (e.g. in case I'm away from the
        office for some time, and AFK for longer), I "hard reset"
        offlineimap once a day at 7am by killing the process and
        restarting it with the other script. <br>
        <br>
        This may not be the most elegant solution, but it seems to work
        :) <br>
        <br>
        Check if running, if not, restart: <br>
        <br>
        #!/bin/bash<br>
        SERVICE='offlineimap'<br>
        ps -ef | grep -v grep | grep -v sh | grep -v SCREEN | grep
        /usr/bin/$SERVICE > /dev/null 2>&1<br>
        if [ $? -eq 1 ]<br>
        then<br>
        echo "`date` $SERVICE is not running! Panic!" >>
        /var/log/offlineimapsh.log<br>
        # echo "$SERVICE is not running!" | mail -s "$SERVICE down" root<br>
        /usr/bin/offlineimap -c /home/discus/.offlineimaprc >>
        /var/log/offlineimapsh.log 2>&1<br>
        echo "`date` $SERVICE restarted" >>
        /var/log/offlineimapsh.log<br>
        else<br>
        echo "`date` eq 0 - $SERVICE is running. Life is peachy."
        >> /var/log/offlineimapsh.log<br>
        fi<br>
      </font>
      <div style="display: inline;"><br>
      </div>
      Hard reset: <br>
      <br>
      #!/bin/bash<br>
      echo "`date` killing offlineimap" >>
      /var/log/offlineimaphardreset7amsh.log<br>
      /usr/bin/pkill offlineimap 2>&1<br>
      echo "`date` offlineimap killed" >>
      /var/log/offlineimaphardreset7amsh.log<br>
      /etc/cron.hourly/offlineimap.sh 2>&1<br>
      echo "`date` offlineimap restarted" >>
      /var/log/offlineimaphardreset7amsh.log<br>
      exit
      <div style="display: inline;"> </div>
      <br>
      <br>
      <font face="Times New Roman">I use offlineimap to sync the Inboxes
        of about 8 users between our in-office mail server and an
        off-site one (we're at the end of an ADSL line, which makes life
        a little painful otherwise); I'm using Ubuntu Server.<br>
      </font><br>
      Best regards,<br>
      <br>
      James Stapley. <br>
      <br>
      On 2011/02/14 04:23 AM, Ng Oon-Ee wrote:
      <blockquote style="font-family: serif;"
        cite="mid:1297650212.29675.5.camel@ngoonee-laptop" type="cite">
        <pre wrap="">Hi all,

I've been thinking about an idea for 'offlineimapd' or something
similar, but am not sure if the functionality is planned for offlineimap
itself.

Firstly, I'm on 64-bit Arch Linux, offlineimap is at 6.3.1 currently.

Since the 6-series release back-in-the-day, offlineimap has given random
hangs with gmail on spotty connections. This probably has more to do
with gmail's sucky IMAP implementation than any inherent offlineimap
fault (since the same does not occur on another gmail account I sync
with), but the net result is that I have conky display the
last-synced-time for offlineimap on my desktop, and when I realize its
been a long time ago (maybe 20 minutes or so) I restart offlineimap.

I thought it'd be useful to have a simple script (offlineimapd for want
of a better name) which monitors the main offlineimap process to restart
it if it hangs. How I've done it manually is to have a hook activate
after every successful sync.

Its not something very complicated, I could probably whip up a simple
bash script which handles that. Would it be a good idea, though? Or
would this sort of logic be best implemented within offlineimap (which
is already multi-threaded, after all).


_______________________________________________
OfflineIMAP-project mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OfflineIMAP-project@lists.alioth.debian.org">OfflineIMAP-project@lists.alioth.debian.org</a>
<a class="moz-txt-link-freetext" href="http://lists.alioth.debian.org/mailman/listinfo/offlineimap-project">http://lists.alioth.debian.org/mailman/listinfo/offlineimap-project</a>

OfflineIMAP homepage: <a class="moz-txt-link-freetext" href="http://software.complete.org/offlineimap">http://software.complete.org/offlineimap</a>
</pre>
      </blockquote>
    </div>
  </body>
</html>