Complete.Org: Mailing Lists: Archives: offlineimap: July 2009:
Running offlineimap indefinately, log success?
Home

Running offlineimap indefinately, log success?

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: offlineimap@xxxxxxxxxxxx
Subject: Running offlineimap indefinately, log success?
From: Ng Oon-Ee <ngoonee@xxxxxxxxx>
Date: Sun, 26 Jul 2009 17:25:53 +0800

Been using offlineimap for my gmail account for quite a while, and it
works great, kudos to the devs. I've been doing it through cron to run a
single instance, which basically calls a small script, which I'll just
post here for reference:-
---------------
#!/bin/sh

# Run offlineimap through cron to fetch email periodically

ps aux | grep "\/usr\/bin\/offlineimap"

if [ $? -eq "0" ]; then
        exit 0;
else
        offlineimap -u Noninteractive.Quiet -o
        if [ $? = 0 ]; then
                touch ~/.offlineimapsuccessful;
                exit 0
        else
                touch ~/.offlineimapfailed;
                exit 1
        fi
fi
---------------

Basically, I have two files whose last modified time indicates the last
successful AND last unsucessful sync. I display this data on my conky,
so I can know when my connection is acting up and my maildir isn't
updating as I'd expect, at a glance.

I've been thinking about not using a cron job to run offlineimap
anymore, however, and simply using autorefresh and quick, with a cron
job to restart offlineimap if its not currently running. However, I'd
like to be able to somehow log the success or otherwise of my sync. Can
postsynchook be used for this? (Does it execute only after successful
sync, does it execute after quick syncs?) Do I have to grep log files,
and which ones would these be? Thanks for your help.




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