Re: How to know if offlineimap is running
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
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
|
|