Complete.Org: Mailing Lists: Archives: offlineimap: January 2009:
Re: How to know if offlineimap is running
Home

Re: How to know if offlineimap is running

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: offlineimap@xxxxxxxxxxxx
Subject: Re: How to know if offlineimap is running
From: Jim Pryor <lists+offlineimap@xxxxxxxxxxxx>
Date: Fri, 9 Jan 2009 06:57:39 -0500

On Thu, Jan 01, 2009 at 02:44:24PM -0500, Loui Chang wrote:
> On Thu, Jan 01, 2009 at 07:33:18PM +0100, Nathan Huesken wrote:
> > I run offlineimap in a cronjob.
> > Is there a way to know when offlineimap is currently running?
> > The .offlineimap/lock file seems to always exist ...
> 
> Maybe you can check if the process described by .offlineimap/pid
> is running.
> 
> It seems like a bug, that .offlineimap/lock always exists,
> but I'm not really familiar with offlineimap's inner workings.


Yes, specifically you can do this (in a Bash script):

CONFIGDIR="$HOME/.offlineimap"  # this is set in your .offlineimaprc, as
the "metadata" setting. I actually have mine at a different location

BINARY=/usr/bin/offlineimap

if [ -f "$CONFIGDIR/pid" -a $(cat "$CONFIGDIR/pid") = \
    $(pidof -x "$BINARY") ]; then
    
    # offlineimap is running

else

    # offlineimap not running

fi




-- 
Jim Pryor
jim@xxxxxxxxxxxx



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